From b608d8f76bc56f802cae1e9d882b8748e88c499d Mon Sep 17 00:00:00 2001 From: wisonic Date: Mon, 15 Dec 2025 18:04:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=80=91=E5=B8=83=E5=9B=BE=E6=8F=90=E7=A4=BA=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/bar/waterfall.ts | 40 +++++-------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/waterfall.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/waterfall.ts index 6236e98981..ed1f38232f 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/waterfall.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/waterfall.ts @@ -102,7 +102,12 @@ export class Waterfall extends G2PlotChartView { xField: 'field', yField: 'value', seriesField: 'category', - appendPadding: getPadding(chart) + appendPadding: getPadding(chart), + meta: { + field: { + type: 'cat' + } + } } const options = this.setupOptions(chart, baseOptions) const { Waterfall: G2Waterfall } = await import('@antv/g2plot/esm/plots/waterfall') @@ -113,33 +118,6 @@ export class Waterfall extends G2PlotChartView { return newChart } - protected configMeta(chart: Chart, options: WaterfallOptions): WaterfallOptions { - const yAxis = chart.yAxis - const meta: WaterfallOptions['meta'] = { - field: { - type: 'cat' - } - } - if (!yAxis?.length) { - return { - ...options, - meta - } - } - const f = yAxis[0] - const yAxisStyle = parseJson(chart.customStyle).yAxis - meta.value = { - alias: f.name, - formatter: (value: number) => { - return valueFormatter(value, yAxisStyle.axisLabelFormatter) - } - } - return { - ...options, - meta - } - } - protected configBasicStyle(chart: Chart, options: WaterfallOptions): WaterfallOptions { const customAttr = parseJson(chart.customAttr) const { colors, gradient, alpha } = customAttr.basicStyle @@ -177,6 +155,11 @@ export class Waterfall extends G2PlotChartView { return tmpOptions } const yAxis = parseJson(chart.customStyle).yAxis + if (tmpOptions.yAxis.label) { + tmpOptions.yAxis.label.formatter = value => { + return valueFormatter(value, yAxis.axisLabelFormatter) + } + } const axisValue = yAxis.axisValue if (!axisValue?.auto) { const axis = { @@ -329,7 +312,6 @@ export class Waterfall extends G2PlotChartView { this.configTooltip, this.configXAxis, this.configYAxis, - this.configMeta, this.configBarConditions )(chart, options) }