vishalpawar048
Posts: 28
Joined: Wed Jan 25, 2023 3:24 am

Stacked bar char width issue

Hi Team,

We are working with the stacked bar chart component.

https://stackblitz.com/edit/react-rshho ... tackbar.js

We have noticed that when the sum of data provided to the series is not a multiple of 100 the bar length changes (does not take the full width of the chart).

How do we make sure that the bar in the chart takes the full width?

Thank you
jakub.s
Posts: 1229
Joined: Fri Dec 16, 2022 11:45 am

Re: Stacked bar char width issue

Hi,

Thanks for the question!

This is related to the length of the yAxis. If you make the yAxis visible you'll notice what's hapenning.

This higher length stems from the yAxis.endOnTick property, which is by default set to true (https://api.highcharts.com/highcharts/yAxis.endOnTick). If you disable it the last tick should disappear (because we do not need the yAxis to end on the "next" tick) in your case and everything should be fine).

Simplified demo: https://jsfiddle.net/BlackLabel/w2Lx4581/

Your demo: https://stackblitz.com/edit/react-rac3j ... tackbar.js

Let me know if that's what you were looking for.

Best regards!
Jakub
Highcharts Developer

Return to “Highcharts Usage”