wormwood
Posts: 12
Joined: Sat Feb 12, 2022 11:11 pm

Redrawing Stacked Columns on Legend Click

Hello. I see a lot of posts about grouping and orienting stacked column charts, and I see a lot of posts about custom legend formatting and/or click handlers, but I don't think any that quite answer what I need.

I'm trying to create a stacked column chart that has categories in the legend. I've got part figured out, but the legend click behavior is different depending on if the category is on the ends of the xAxis. If it's an endpoint category, then clicking the legend hides the data and the chart redraws/rescales. However, if the category is in the middle the data is hidden but the chart leaves the blank space visible.

Example: http://jsfiddle.net/gL0rk54x/2/

Is there anyway to resize/scale the remaining visible categories?
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Redrawing Stacked Columns on Legend Click

Hello,

In this case using grouped categories and stacking it is hard to achieve, you would have to pull all the series into a variable and add your own logic to legendItemClick that would parse this data to display only visible groups and you would have to somehow check the category visibility status to list them properly in the legend. This is quite a custom solution and goes beyond the scope of forum support.

Regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Usage”