diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableTotalSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableTotalSelector.vue index 9a35cec777..b87d8c83e8 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableTotalSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableTotalSelector.vue @@ -32,6 +32,7 @@ watch( ) const aggregations = [ + { name: t('chart.none'), value: 'NONE' }, { name: t('chart.sum'), value: 'SUM' }, { name: t('chart.avg'), value: 'AVG' }, { name: t('chart.max'), value: 'MAX' }, diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts index ecd9798669..3b9ed23a9f 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts @@ -538,7 +538,7 @@ export class TablePivot extends S2ChartView { } function customCalcFunc(query, data, status, chart, totalCfgMap, axisMap, customCalc) { if (!data?.length || !query[EXTRA_FIELD]) { - return 0 + return '-' } const aggregation = totalCfgMap[query[EXTRA_FIELD]]?.aggregation || 'SUM' switch (aggregation) { @@ -565,6 +565,9 @@ function customCalcFunc(query, data, status, chart, totalCfgMap, axisMap, custom }) return result?.[query[EXTRA_FIELD]] } + case 'NONE': { + return '-' + } case 'CUSTOM': { const val = getCustomCalcResult(query, axisMap, chart, status, customCalc || {}) if (val === '') {