7
votes

I have a highcharts pie chart which allows you to remove slices by clicking on the legend.

http://jsfiddle.net/f3Lx6cxk/

I want to programatically hide slices aftr the chart has been rendered. In my jsfiddle, the button calls

chart.series[0].data[i].select();

which has the effect of sliding the slice out. I want a similar call to remove the slice altogether, but leave it greyed out in the legend (so point.remove is no good). The effect should be the same as clicking on the legend item.

1

1 Answers

6
votes

You can use setVisible function:

    $('#button').click(function () {
    if(sliced)
        chart.series[0].data[0].setVisible(true);
    else
chart.series[0].data[0].setVisible(false);

        sliced=!sliced;
    });

http://jsfiddle.net/f3Lx6cxk/1/