-
Notifications
You must be signed in to change notification settings - Fork 281
Closed
Labels
Description
Background
I am trying to make a stacked bar chart where some values are 0. I don't expect these values to show up on the final chart.
Problem
Even when the value is 0, I can still highlight the pixel for the 0 value.
Cause
Rectangle is created even when the height is set to 0. This is regardless of minBarHeight={0}.
Possible Solution
Modify BarChart.js to not create a rectangle when height is 0
// Allow negative values. Minimum bar height = 1 pixel.
// Stack negative bars below X-axis and positive above X-Axis
var positiveBar = height >= 0;
height = Math.max(Math.abs(height), minBarHeight);
var y = positiveBar ? yposPositive - height : yposNegative;
if(height == 0) return;sartaj10