From 9f75b0c0ba22e25b3a9994c4cee88b875b2688b4 Mon Sep 17 00:00:00 2001 From: Edoardo Sabadelli Date: Fri, 10 Nov 2023 15:59:27 +0100 Subject: [PATCH] fix: store rendered values in accumulators --- src/modules/pivotTable/PivotTableEngine.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/modules/pivotTable/PivotTableEngine.js b/src/modules/pivotTable/PivotTableEngine.js index abef32923..20305f671 100644 --- a/src/modules/pivotTable/PivotTableEngine.js +++ b/src/modules/pivotTable/PivotTableEngine.js @@ -417,7 +417,7 @@ export class PivotTableEngine { const value = this.getRaw({ row: mappedRow, column: mappedColumn }) - // XXX cannot be done directly in getRaw because of the resetAccumulators function + // NB: cannot be done directly in getRaw because of the resetAccumulators function if (this.options.cumulativeValues) { const cumulativeValue = this.getCumulative({ row: mappedRow, @@ -431,11 +431,7 @@ export class PivotTableEngine { ? VALUE_TYPE_NUMBER : value.valueType value.empty = false - value.renderedValue = renderValue( - cumulativeValue, - value.valueType, - this.visualization - ) + value.renderedValue = cumulativeValue } } @@ -1014,7 +1010,13 @@ export class PivotTableEngine { if (value.valueType === VALUE_TYPE_NUMBER) { acc += value.empty ? 0 : value.rawValue - this.accumulators.rows[row][column] = acc + const renderedValue = renderValue( + acc, + value.valueType, + this.visualization + ) + + this.accumulators.rows[row][column] = renderedValue } return acc