stan0401
Posts: 8
Joined: Thu Mar 30, 2023 4:08 am

Highcharts 'percent' stacking not working as expected

Version:
Highcharts 9.2.0
highcharts-react-officiat 3.0.0

I'm trying to do 'percent' stacking, but it turns out one of the bars are on top of another.
https://imgur.com/a/Zr5QLzp
Image

I've tried 'normal', which works fine.
I've tested the same code in jsfiddle, which works fine too https://jsfiddle.net/580z6njb/1/
However, it looks like above when I reproduce using the same code on my local host.
Does anyone know what might be causing this problem?
kamil.k
Posts: 458
Joined: Thu Oct 06, 2022 12:49 pm

Re: Highcharts 'percent' stacking not working as expected

Hello stan0401,

Welcome to our forum and thanks for contacting us with your question!

There's no need to do any extras apart from the basic config to use this feature, so it should be working in every environment. I've tested it also with React as your demo shows pure JS and it seems to be working correctly.

What I can see from your demo is the repeated implementation of the stacking: percent future. You did it both as plotOptions.bar.stacking as well as the plotOptions.series.stacking. Note that in this case, the below value overrides the top one so I'd suggest safely defining it directly on a series, as shown here: https://jsfiddle.net/BlackLabel/o2gdxkhm/.

What's more, on your screen, the axis max value shows 140 that in your case, should be 100 as a representation of the percentages. I'd suggest assuming that the feature hasn't been correctly implemented and playing around with it to find a solution.

Unfortunately, as it's working properly in the demo, I can't help you better as I have no insight into your local environment.

Let me know if you figured it out and if not, feel free to share more information about your local Highcharts config,
Kind Regards!
Kamil Kubik
Highcharts Developer

Return to “Highcharts Usage”