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