Skip to content

Commit

Permalink
fix: do not fill the table with N/A with cumulative values
Browse files Browse the repository at this point in the history
Simply render the original value for non cumulative types.
The tooltip can be used when in doubt to know if a cell value is
accumulated.
  • Loading branch information
edoardo committed Oct 15, 2024
1 parent 7de9aab commit 4414f42
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/modules/pivotTable/PivotTableEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ export class PivotTableEngine {

// only accumulate numeric (except for PERCENTAGE and UNIT_INTERVAL) and boolean values
// accumulating other value types like text values does not make sense
if (acc !== VALUE_NA && isCumulativeValueType(valueType)) {
if (isCumulativeValueType(valueType)) {
// initialise to 0 for cumulative types
// (||= is not transformed correctly in Babel with the current setup)
acc || (acc = 0)
Expand All @@ -1108,13 +1108,9 @@ export class PivotTableEngine {

acc += parseValue(rawValue)
}
} else {
// show N/A from the first non-cumulative type and onwards
// only if a previous value is present (this is to avoid filling empty rows with N/A)
acc = acc ? VALUE_NA : ''
}

this.accumulators.rows[row][column] = acc
this.accumulators.rows[row][column] = acc
}

return acc
}, '')
Expand Down

0 comments on commit 4414f42

Please sign in to comment.