Highcharts: how to make slices readjust when disabling one?

1k views Asked by At

Is this possible? I want the other slices in the pie chart to adjust to a full circle when one is disabled in the legend, rather than just making an empty slice..

1

There are 1 answers

1
eolsson On BEST ANSWER

If you change the behavior of the legendItemClick event handler you can remove the sector instead of hiding it.

    pie: {
         point: {
            events: {
                legendItemClick: function (eventArgs) {
                    this.remove(); // Remove the point
                    eventArgs.preventDefault(); // Prevent the default behavior
                }
            }
        },
        showInLegend: true
    }

This will only get you half the way though. The problem is that you cannot get the point back since it will be removed from the legend as well.

A way to get around this would be to add a reset button that brings back the original data set with series.setData(). See this jsfiddle example.