Bar center the axis


#1

I created a Bar chart with a dataset that includes some negative values and it looks good at first. However, the chart behaves symmetrically with +500/-500 on the y-axis even though the max value in the dataset is 500 and the min value is -5. Can it not try to center the axis?


#2

Hi @Joseph, my guess is that you don’t want this default behavior on your bar chart. When you have negative values the Bar chart tries to adjust the axis to be centered by default. You can use the center property defined in the x-axis/y-axis to avoid this. You can use this code:
.set(“xAxis”, { center: false }). This way, the axis max/min values are adjusted to the dataset values without trying to center them.