From c9043ebd78cb8c115b0adef078fb25bf135ebcac Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 11 Jan 2023 17:15:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E8=A7=86=E5=9B=BE):=20Echarts?= =?UTF-8?q?=E7=9F=A9=E5=BD=A2=E6=A0=91=E5=9B=BE=E6=94=AF=E6=8C=81=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=84=A6=E7=82=B9=E5=86=8D=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/chart.js | 1 + .../src/views/chart/components/ChartComponent.vue | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index 1a2bb44af6..7ac95843e9 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -1021,6 +1021,7 @@ export const BASE_TREEMAP = { { // name: '', type: 'treemap', + roam: true, itemStyle: { gapWidth: 2 }, diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index fbabbf5240..e3f83c8a0e 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -128,6 +128,7 @@ export default { showSuspension: true, currentSeriesId: null, haveScrollType: [ + 'treemap', 'map', 'chart-mix', 'bar', @@ -198,7 +199,13 @@ export default { if (this.haveScrollType.includes(this.chart.type)) { const opt = this.myChart.getOption() this.adaptorOpt(opt) - this.myChart.setOption(opt) + if (this.chart.type === 'treemap') { + this.myChart.dispose() + this.myChart = null + this.preDraw() + } else { + this.myChart.setOption(opt) + } } }, adaptorOpt(opt) { @@ -218,6 +225,10 @@ export default { opt.geo.roam = this.active } } + //矩形树图 + if (this.chart.type === 'treemap' && opt.series) { + opt.series[0].roam = this.active + } }, changeSeriesId(param) { const { id, seriesId } = param