fix: 图表重复点击tab坍缩问题
This commit is contained in:
@@ -373,15 +373,13 @@ export default {
|
|||||||
if (tab === 0) {
|
if (tab === 0) {
|
||||||
dom = document.getElementById('link-traffic-sankey-0')
|
dom = document.getElementById('link-traffic-sankey-0')
|
||||||
if (this.myChart) {
|
if (this.myChart) {
|
||||||
this.myChart = null
|
this.myChart.dispose()
|
||||||
}
|
}
|
||||||
this.myChart = echarts.init(dom)
|
|
||||||
} else {
|
} else {
|
||||||
dom = document.getElementById('link-traffic-sankey-1')
|
dom = document.getElementById('link-traffic-sankey-1')
|
||||||
if (this.myChart2) {
|
if (this.myChart2) {
|
||||||
this.myChart2 = null
|
this.myChart2.dispose()
|
||||||
}
|
}
|
||||||
this.myChart2 = echarts.init(dom)
|
|
||||||
}
|
}
|
||||||
this.chartOption = this.$_.cloneDeep(linksTrafficSankeyOption)
|
this.chartOption = this.$_.cloneDeep(linksTrafficSankeyOption)
|
||||||
this.chartOption.tooltip.formatter = function (param) {
|
this.chartOption.tooltip.formatter = function (param) {
|
||||||
@@ -413,11 +411,15 @@ export default {
|
|||||||
}
|
}
|
||||||
this.chartOption.series[0].data = data
|
this.chartOption.series[0].data = data
|
||||||
this.chartOption.series[0].links = links
|
this.chartOption.series[0].links = links
|
||||||
|
this.$nextTick(() => {
|
||||||
if (tab === 0) {
|
if (tab === 0) {
|
||||||
|
this.myChart = echarts.init(dom)
|
||||||
this.myChart.setOption(this.chartOption)
|
this.myChart.setOption(this.chartOption)
|
||||||
} else {
|
} else {
|
||||||
|
this.myChart2 = echarts.init(dom)
|
||||||
this.myChart2.setOption(this.chartOption)
|
this.myChart2.setOption(this.chartOption)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
resize () {
|
resize () {
|
||||||
if (this.tab === 0) {
|
if (this.tab === 0) {
|
||||||
|
|||||||
@@ -388,11 +388,10 @@ export default {
|
|||||||
// 此处为验证是否因dom未销毁,导致图表出错,后续可能会改
|
// 此处为验证是否因dom未销毁,导致图表出错,后续可能会改
|
||||||
let dom = null
|
let dom = null
|
||||||
dom = document.getElementById('overviewLineChart')
|
dom = document.getElementById('overviewLineChart')
|
||||||
// this.myChart = null
|
|
||||||
if (this.myChart) {
|
if (this.myChart) {
|
||||||
this.myChart = null
|
this.myChart.dispose()
|
||||||
}
|
}
|
||||||
this.myChart = echarts.init(dom)
|
|
||||||
this.chartOption = stackedLineChartOption
|
this.chartOption = stackedLineChartOption
|
||||||
const chartOption = this.chartOption.series[0]
|
const chartOption = this.chartOption.series[0]
|
||||||
this.chartOption.series = echartsData.map((t, i) => {
|
this.chartOption.series = echartsData.map((t, i) => {
|
||||||
@@ -486,12 +485,12 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
const str = stackedLineTooltipFormatter(params)
|
return stackedLineTooltipFormatter(params)
|
||||||
return str
|
|
||||||
}
|
}
|
||||||
this.showMarkLine = true
|
this.showMarkLine = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.myChart = echarts.init(dom)
|
||||||
this.myChart.setOption(this.chartOption)
|
this.myChart.setOption(this.chartOption)
|
||||||
|
|
||||||
// 设置参见官网:https://echarts.apache.org/zh/api.html#action.brush.brush
|
// 设置参见官网:https://echarts.apache.org/zh/api.html#action.brush.brush
|
||||||
this.myChart.dispatchAction({
|
this.myChart.dispatchAction({
|
||||||
// 刷选模式的开关。使用此 action 可将当前鼠标变为可刷选状态。事实上,点击 toolbox 中的 brush 按钮时,就是通过这个 action,将当前普通鼠标变为刷选器的。
|
// 刷选模式的开关。使用此 action 可将当前鼠标变为可刷选状态。事实上,点击 toolbox 中的 brush 按钮时,就是通过这个 action,将当前普通鼠标变为刷选器的。
|
||||||
@@ -537,6 +536,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
activeChange (item, index) {
|
activeChange (item, index) {
|
||||||
if (this.isNoData) return
|
if (this.isNoData) return
|
||||||
|
|||||||
Reference in New Issue
Block a user