forked from github/dataease
Merge pull request #3798 from dataease/pr@dev@fix_map_switch_series_drill
fix(地图): 多系列数据下钻问题
This commit is contained in:
commit
944b0d06dc
@ -37,7 +37,7 @@ const fillGradientColor = (data, colors) => {
|
||||
})
|
||||
return data
|
||||
}
|
||||
export function baseMapOption(chart_option, chart, themeStyle, curAreaCode) {
|
||||
export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seriesId) {
|
||||
// 处理shape attr
|
||||
let customAttr = {}
|
||||
let isGradient = false
|
||||
@ -45,7 +45,7 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode) {
|
||||
if (chart.customAttr) {
|
||||
customAttr = JSON.parse(chart.customAttr)
|
||||
if (chart.yaxis && chart.yaxis.length > 1) {
|
||||
let currentSeriesId = customAttr.currentSeriesId
|
||||
let currentSeriesId = seriesId
|
||||
const yAxis = JSON.parse(chart.yaxis)
|
||||
if (!currentSeriesId || !yAxis.some(item => item.id === currentSeriesId)) {
|
||||
currentSeriesId = yAxis[0].id
|
||||
|
@ -119,7 +119,8 @@ export default {
|
||||
linkageActiveParam: null,
|
||||
buttonTextColor: null,
|
||||
loading: true,
|
||||
showSuspension: true
|
||||
showSuspension: true,
|
||||
currentSeriesId: null
|
||||
}
|
||||
},
|
||||
|
||||
@ -132,6 +133,11 @@ export default {
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
currentSeriesId(value, old) {
|
||||
if (value !== old) {
|
||||
this.preDraw()
|
||||
}
|
||||
},
|
||||
chart: {
|
||||
handler(newVal, oldVla) {
|
||||
this.preDraw()
|
||||
@ -171,9 +177,7 @@ export default {
|
||||
if (id !== this.chart.id) {
|
||||
return
|
||||
}
|
||||
const customAttr = JSON.parse(this.chart.customAttr)
|
||||
customAttr.currentSeriesId = seriesId
|
||||
this.chart.customAttr = JSON.stringify(customAttr)
|
||||
this.currentSeriesId = seriesId
|
||||
},
|
||||
reDrawView() {
|
||||
this.myChart.dispatchAction({
|
||||
@ -366,7 +370,7 @@ export default {
|
||||
this.buttonTextColor = null
|
||||
}
|
||||
}
|
||||
const chart_option = baseMapOption(base_json, chart, this.buttonTextColor, curAreaCode)
|
||||
const chart_option = baseMapOption(base_json, chart, this.buttonTextColor, curAreaCode, this.currentSeriesId)
|
||||
this.myEcharts(chart_option)
|
||||
const opt = this.myChart.getOption()
|
||||
if (opt && opt.series) {
|
||||
|
Loading…
Reference in New Issue
Block a user