Merge pull request #6621 from dataease/pr@dev@fix_map_mapping

fix: echarts地图高级配置地名映射会影响地图颜色#6192
This commit is contained in:
fit2cloud-chenyw 2023-11-09 17:39:58 +08:00 committed by GitHub
commit c9fec321eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -467,6 +467,25 @@ export default {
}
}
const chart_option = baseMapOption(base_json, geoJson, chart, this.buttonTextColor, curAreaCode, this.currentSeriesId)
if (chart_option.series?.length) {
const dataNames = []
chart_option.series.filter(se => se.type === 'map').forEach(se => {
se.data.forEach(d => {
if (d?.name) {
dataNames.push(d.name)
}
})
})
for (const key in chart_option.geo.nameMap) {
if (Object.hasOwnProperty.call(chart_option.geo.nameMap, key)) {
const element = chart_option.geo.nameMap[key]
if (element && !dataNames.includes(element)) {
chart_option.geo.nameMap[key] = key
}
}
}
}
this.myEcharts(chart_option)
const opt = this.myChart.getOption()
if (opt && opt.series) {