From a3e51bce302c5a2f49cb2a82c7403c40834bff2e Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Tue, 31 Oct 2023 22:16:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8D=95=E7=B3=BB=E5=88=97=E6=9D=A1?= =?UTF-8?q?=E5=BD=A2=E5=9B=BE=E5=92=8C=E6=9F=B1=E7=8A=B6=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E9=A2=9C=E8=89=B2=E4=BF=AE=E6=94=B9=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/js/panel/charts/bar/bar.ts | 2 ++ .../chart/components/js/panel/charts/bar/horizontal-bar.ts | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts index 817ab36a17..ead63e3e82 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts @@ -116,6 +116,7 @@ export class Bar extends G2PlotChartView { pre[next.id] = next return pre }, {}) + // 默认是灰色 tmpOptions.label.style.fill = DEFAULT_LABEL.color const label = { fields: [], @@ -242,6 +243,7 @@ export class StackBar extends Bar { return baseOptions } const { label: labelAttr } = parseJson(chart.customAttr) + baseOptions.label.style.fill = labelAttr.color const label = { ...baseOptions.label, formatter: function (param: Datum) { diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/horizontal-bar.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/horizontal-bar.ts index 2d7e5b9f3c..1ddc990762 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/horizontal-bar.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/horizontal-bar.ts @@ -164,11 +164,12 @@ export class HorizontalBar extends G2PlotChartView { } setupDefaultOptions(chart: ChartObj): ChartObj { - const { customAttr } = chart + const { customAttr, senior } = chart const { label } = customAttr if (!['left', 'middle', 'right'].includes(label.position)) { label.position = 'middle' } + senior.functionCfg.emptyDataStrategy = 'ignoreData' return chart } @@ -185,6 +186,7 @@ export class HorizontalBar extends G2PlotChartView { pre[next.id] = next return pre }, {}) + // 默认灰色 tmpOptions.label.style.fill = DEFAULT_LABEL.color const label = { fields: [], @@ -272,6 +274,7 @@ export class HorizontalStackBar extends HorizontalBar { return baseOptions } const { label: labelAttr } = parseJson(chart.customAttr) + baseOptions.label.style.fill = labelAttr.color const label = { ...baseOptions.label, formatter: function (param: Datum) {