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
const valueArr = chart.data.series[0].data
const values = []
valueArr.forEach(function(ele) {
values.push(ele.value)
})
chart_option.visualMap.min = Math.min(...values)
chart_option.visualMap.max = Math.max(...values)
if (chart_option.visualMap.min === chart_option.visualMap.max) {
if (valueArr && valueArr.length > 0) {
const values = []
valueArr.forEach(function(ele) {
values.push(ele.value)
})
chart_option.visualMap.min = Math.min(...values)
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.max = 0
}
// color
if (customAttr.color && customAttr.color.colors) {
chart_option.visualMap.inRange.color = customAttr.color.colors
chart_option.visualMap.inRange.colorAlpha = customAttr.color.alpha / 100