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 55fcd7eb23..5aeb7911da 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 @@ -344,30 +344,30 @@ function customCalcFunc(query, data, totalCfgMap) { switch (aggregation) { case 'SUM': { return data.reduce((p, n) => { - return p + n[query[EXTRA_FIELD]] + return p + parseFloat(n[query[EXTRA_FIELD]]) }, 0) } case 'AVG': { const sum = data.reduce((p, n) => { - return p + n[query[EXTRA_FIELD]] + return p + parseFloat(n[query[EXTRA_FIELD]]) }, 0) return sum / data.length } case 'MIN': { const result = minBy(data, n => { - return n[query[EXTRA_FIELD]] + return parseFloat(n[query[EXTRA_FIELD]]) }) return result?.[query[EXTRA_FIELD]] } case 'MAX': { const result = maxBy(data, n => { - return n[query[EXTRA_FIELD]] + return parseFloat(n[query[EXTRA_FIELD]]) }) return result?.[query[EXTRA_FIELD]] } default: { return data.reduce((p, n) => { - return p + n[query[EXTRA_FIELD]] + return p + parseFloat(n[query[EXTRA_FIELD]]) }, 0) } } diff --git a/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts b/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts index fd3aca5f28..6e48c50c4c 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts @@ -598,7 +598,7 @@ export function mappingColor(value, defaultColor, field, type) { } export function handleTableEmptyStrategy(chart: Chart) { - let newData = chart.data?.tableRow as Record[] + let newData = (chart.data?.tableRow || []) as Record[] let intersectionArr = [] const senior = parseJson(chart.senior) let emptyDataStrategy = senior?.functionCfg?.emptyDataStrategy