vicks22
Posts: 10
Joined: Fri Feb 17, 2023 12:56 pm

stackLabel on column chart display negative value twice

Hi,

I am drawing column chart with stacking: 'normal'. But for negative values it is displaying twice as shown in screenshot.

I want to display negative value only once below its bar.

And what I observed is it is adding <g class="highcharts-label highcharts-stack-labels" visibility="hidden" .............. as shown in attached screenshot.
Attachments
stackLabel-negative-value.PNG
stackLabel-negative-value.PNG (12.95 KiB) Viewed 297 times
stackLabel-visibility-hidden.PNG
stackLabel-visibility-hidden.PNG (79.94 KiB) Viewed 297 times
vicks22
Posts: 10
Joined: Fri Feb 17, 2023 12:56 pm

Re: stackLabel on column chart display negative value twice

Here is the stackLabels properties I am providing.
Attachments
stackLabel-options.PNG
stackLabel-options.PNG (19.18 KiB) Viewed 296 times
User avatar
dawid.d
Posts: 837
Joined: Thu Oct 06, 2022 11:31 am

Re: stackLabel on column chart display negative value twice

Hi,

Thanks for contacting us with your question!

Can you provide a demo of your problem prepared e.g. in jsfiddle? Seeing your use case will make it easier for me to be able to identify the source of the problem.

I'm waiting for your reply
Best regards!
Dawid Draguła
Highcharts Developer
vicks22
Posts: 10
Joined: Fri Feb 17, 2023 12:56 pm

Re: stackLabel on column chart display negative value twice

Hi,

This is fixed using one of the solution provided by calculating sum and checking it.

if (sum < 0 && this.isNegative) return sum + '';
else if (sum >= 0 && !this.isNegative) return sum + '';
return '';

Thank you.
User avatar
dawid.d
Posts: 837
Joined: Thu Oct 06, 2022 11:31 am

Re: stackLabel on column chart display negative value twice

Hi,

I'm glad you found a solution.

Also, if you think the problem is a bug that is not from your use case but from the core, you can report it to our official GitHub here:
https://github.com/highcharts/highchart ... new/choose

Feel free to ask any further questions!
Best regards!
Dawid Draguła
Highcharts Developer

Return to “Highcharts Usage”