diff --git a/frontend/src/views/chart/chart/waterfall/waterfall.js b/frontend/src/views/chart/chart/waterfall/waterfall.js index 10849c082a..50fc18db85 100644 --- a/frontend/src/views/chart/chart/waterfall/waterfall.js +++ b/frontend/src/views/chart/chart/waterfall/waterfall.js @@ -7,6 +7,7 @@ import { getYAxis } from '@/views/chart/chart/common/common_antv' import { Waterfall } from '@antv/g2plot' +import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter' export function baseWaterfallOptionAntV(plot, container, chart, action) { // theme @@ -42,6 +43,7 @@ export function baseWaterfallOptionAntV(plot, container, chart, action) { yField: 'value', seriesField: 'category', appendPadding: getPadding(chart), + meta: getMeta(chart), label: label, tooltip: tooltip, legend: { @@ -102,3 +104,24 @@ export function baseWaterfallOptionAntV(plot, container, chart, action) { return plot } + +function getMeta(chart) { + const meta = {} + const yaxis = JSON.parse(chart.yaxis) + if (yaxis && yaxis.length > 0) { + const f = yaxis[0] + meta.value = { + alias: f.name, + formatter: (value) => { + let res + if (f.formatterCfg) { + res = valueFormatter(value, f.formatterCfg) + } else { + res = valueFormatter(value, formatterItem) + } + return res + } + } + } + return meta +} diff --git a/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue b/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue index 6da2657a2e..be3fae9759 100644 --- a/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue +++ b/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue @@ -100,7 +100,7 @@ {{ $t('chart.filter') }}... - + {{ $t('chart.value_formatter') }}... diff --git a/frontend/src/views/chart/components/drag-item/QuotaItem.vue b/frontend/src/views/chart/components/drag-item/QuotaItem.vue index 80b65eb55b..c24a7d61c8 100644 --- a/frontend/src/views/chart/components/drag-item/QuotaItem.vue +++ b/frontend/src/views/chart/components/drag-item/QuotaItem.vue @@ -100,7 +100,7 @@ {{ $t('chart.filter') }}... - + {{ $t('chart.value_formatter') }}... diff --git a/frontend/src/views/chart/components/value-formatter/ValueFormatterEdit.vue b/frontend/src/views/chart/components/value-formatter/ValueFormatterEdit.vue index fc70d7b8ad..ecc75a39c9 100644 --- a/frontend/src/views/chart/components/value-formatter/ValueFormatterEdit.vue +++ b/frontend/src/views/chart/components/value-formatter/ValueFormatterEdit.vue @@ -33,7 +33,7 @@