Version
6.1.0
Link to Minimal Reproduction
https://codepen.io/Benjamin-Mampaey/pen/GgrQPGO
Steps to Reproduce
On the waterfall example, change the stackStrategy to 'all' on the Expenses series (and eventually on the others too) instead of the default stackStrategy: 'samesign'
Current Behavior
Bars from the Expenses series disappear when the value of the Incomes series is null (i.e. '-')
Expected Behavior
The stacking should exclude null values from the series Incomes, so that the sum does not become null, and the following series can be stacked.
Environment
- OS:
- Browser:
- Framework:
Any additional comments?
In file src/processor/dataStack.ts :
// Considering positive stack, negative stack and empty data
if (
stackStrategy === 'all' // single stack group
|| (stackStrategy === 'positive' && val > 0)
|| (stackStrategy === 'negative' && val < 0)
|| (stackStrategy === 'samesign' && sum >= 0 && val > 0) // All positive stack
|| (stackStrategy === 'samesign' && sum <= 0 && val < 0) // All negative stack
) {
// The sum has to be very small to be affected by the
// floating arithmetic problem. An incorrect result will probably
// cause axis min/max to be filtered incorrectly.
sum = addSafe(sum, val);
stackedOver = val;
break;
}
if val is null, and stackStrategy === 'all' , when sum = addSafe(sum, val); is executed, sum becomes null
if val is null, and stackStrategy === 'samesign', because && val > 0 evaluates to False, sum = addSafe(sum, val); is not executed
There should be a safegard that val is not null
Version
6.1.0
Link to Minimal Reproduction
https://codepen.io/Benjamin-Mampaey/pen/GgrQPGO
Steps to Reproduce
On the waterfall example, change the stackStrategy to 'all' on the Expenses series (and eventually on the others too) instead of the default stackStrategy: 'samesign'
Current Behavior
Bars from the Expenses series disappear when the value of the Incomes series is null (i.e. '-')
Expected Behavior
The stacking should exclude null values from the series Incomes, so that the sum does not become null, and the following series can be stacked.
Environment
Any additional comments?
In file src/processor/dataStack.ts :
// Considering positive stack, negative stack and empty data
if (
stackStrategy === 'all' // single stack group
|| (stackStrategy === 'positive' && val > 0)
|| (stackStrategy === 'negative' && val < 0)
|| (stackStrategy === 'samesign' && sum >= 0 && val > 0) // All positive stack
|| (stackStrategy === 'samesign' && sum <= 0 && val < 0) // All negative stack
) {
// The sum has to be very small to be affected by the
// floating arithmetic problem. An incorrect result will probably
// cause axis min/max to be filtered incorrectly.
sum = addSafe(sum, val);
stackedOver = val;
break;
}
if val is null, and stackStrategy === 'all' , when
sum = addSafe(sum, val);is executed, sum becomes nullif val is null, and stackStrategy === 'samesign', because
&& val > 0evaluates to False,sum = addSafe(sum, val);is not executedThere should be a safegard that val is not null