score:22

Accepted answer

Highcharts does allow us to toggle the legend states from outside.

series[0].hide(); series[0].show(); are provided by highcharts which we can use to implement the functionality you asked for.

here is a fiddle for your reference http://jsfiddle.net/gfNYk/1/

score:3

series[i].visible is the property

score:3

If you have a lot of series, hide() and show() can result in very bad performance. Alternatively you can use setVisible() on each series and redraw() at the end.

    $('#uncheckAll').click(function(){
        var chart = $('#container').highcharts();
        var series = chart.series;
        for(i=0; i < chart.series.length; i++) {
            series[i].setVisible(false, false);
        }
        chart.redraw();
    });

    $('#checkAll').click(function(){
        var chart = $('#container').highcharts();
        var series = chart.series;
        for(i=0; i < chart.series.length; i++) {
            series[i].setVisible(true, true);
        }
        chart.redraw();
    });

to determine if a series is selected you can use the series.visible property


Related Query

More Query from same tag