Merge pull request #617 from dataease/pr@dev@feat_map

feat: 地图颜色
This commit is contained in:
XiaJunjie2020 2021-08-13 13:37:09 +08:00 committed by GitHub
commit 76bdbd7170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,16 +33,21 @@ export function baseMapOption(chart_option, chart) {
} }
// visualMap // visualMap
const valueArr = chart.data.series[0].data const valueArr = chart.data.series[0].data
const values = [] if (valueArr && valueArr.length > 0) {
valueArr.forEach(function(ele) { const values = []
values.push(ele.value) valueArr.forEach(function(ele) {
}) values.push(ele.value)
chart_option.visualMap.min = Math.min(...values) })
chart_option.visualMap.max = Math.max(...values) chart_option.visualMap.min = Math.min(...values)
if (chart_option.visualMap.min === chart_option.visualMap.max) { chart_option.visualMap.max = Math.max(...values)
if (chart_option.visualMap.min === chart_option.visualMap.max) {
chart_option.visualMap.min = 0
}
} else {
chart_option.visualMap.min = 0 chart_option.visualMap.min = 0
chart_option.visualMap.max = 0
} }
// color
if (customAttr.color && customAttr.color.colors) { if (customAttr.color && customAttr.color.colors) {
chart_option.visualMap.inRange.color = customAttr.color.colors chart_option.visualMap.inRange.color = customAttr.color.colors
chart_option.visualMap.inRange.colorAlpha = customAttr.color.alpha / 100 chart_option.visualMap.inRange.colorAlpha = customAttr.color.alpha / 100