Skip to content

Commit

Permalink
fix: store rendered values in accumulators
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo committed Nov 10, 2023
1 parent 321e0ac commit 96be499
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/modules/pivotTable/PivotTableEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 96be499

Please sign in to comment.