From 90bc05bdd1de215bf0397adeb226f6d1312c71f1 Mon Sep 17 00:00:00 2001 From: wisonic Date: Fri, 28 Feb 2025 17:47:41 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E9=80=8F=E8=A7=86?= =?UTF-8?q?=E8=A1=A8=E6=80=BB=E8=AE=A1=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=BA=E6=97=A0=20#9732?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor-style/components/table/TableTotalSelector.vue | 1 + .../chart/components/js/panel/charts/table/table-pivot.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) 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 === '') {