From 4db2c3e273180434c3a52f25572afb8b6ea20bc6 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Tue, 27 Feb 2024 14:56:01 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E8=A7=86=E5=9B=BE):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=A7=86=E5=9B=BE=E9=BB=98=E8=AE=A4=E5=9B=BE=E4=BE=8B?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/chart/components/js/panel/charts/others/funnel.ts | 4 +++- .../views/chart/components/js/panel/charts/others/treemap.ts | 4 +++- .../src/views/chart/components/js/panel/charts/pie/pie.ts | 4 +++- .../src/views/chart/components/js/panel/charts/pie/rose.ts | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/funnel.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/funnel.ts index 6e2508b04d..39beb3d0a0 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/funnel.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/funnel.ts @@ -125,7 +125,7 @@ export class Funnel extends G2PlotChartView { )(chart, options) } setupDefaultOptions(chart: ChartObj): ChartObj { - const { customAttr } = chart + const { customAttr, customStyle } = chart const { label } = customAttr if (!['left', 'middle', 'right'].includes(label.position)) { label.position = 'middle' @@ -134,6 +134,8 @@ export class Funnel extends G2PlotChartView { ...label, show: true } + const { legend } = customStyle + legend.show = false return chart } diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/treemap.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/treemap.ts index 183e178b1f..4dd3e81e85 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/treemap.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/treemap.ts @@ -201,7 +201,7 @@ export class Treemap extends G2PlotChartView { } setupDefaultOptions(chart: ChartObj): ChartObj { - const customAttr = chart.customAttr + const { customAttr, customStyle } = chart const { label } = customAttr customAttr.label = { ...label, @@ -210,6 +210,8 @@ export class Treemap extends G2PlotChartView { showProportion: true, reserveDecimalCount: 2 } + const { legend } = customStyle + legend.show = false return chart } diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/pie/pie.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/pie/pie.ts index d01b48dc62..18ef84cdf4 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/pie/pie.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/pie/pie.ts @@ -218,7 +218,7 @@ export class Pie extends G2PlotChartView { } } setupDefaultOptions(chart: ChartObj): ChartObj { - const customAttr = chart.customAttr + const { customAttr, customStyle } = chart const { label } = customAttr if (!['inner', 'outer'].includes(label.position)) { label.position = 'outer' @@ -230,6 +230,8 @@ export class Pie extends G2PlotChartView { showProportion: true, reserveDecimalCount: 2 } + const { legend } = customStyle + legend.show = false return chart } diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/pie/rose.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/pie/rose.ts index 3916a3ab75..4fd1846860 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/pie/rose.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/pie/rose.ts @@ -203,7 +203,7 @@ export class Rose extends G2PlotChartView { } setupDefaultOptions(chart: ChartObj): ChartObj { - const customAttr = chart.customAttr + const { customAttr, customStyle } = chart const { label } = customAttr if (!['inner', 'outer'].includes(label.position)) { label.position = 'outer' @@ -215,6 +215,8 @@ export class Rose extends G2PlotChartView { showProportion: true, reserveDecimalCount: 2 } + const { legend } = customStyle + legend.show = false return chart }