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) }