How to Check and Uncheck all the Legend elements in HighCharts Linechart?

sakar picture sakar · May 3, 2013 · Viewed 10.4k times · Source

I want customize the checking and unchecking legend elements all at once, iam not getting any idea, can we do this? let me know way to do this..

Answer

jlbriggs picture jlbriggs · May 3, 2013

This is an example that does that, plus a variety of other things with legend items and checkboxes, using a series of external controls:

http://jsfiddle.net/simo/57SR9/94/

function:

$('#checkAll').click(function(){
    for(i=0; i < chart.series.length; i++) {
        if(chart.series[i].selected == false){
            chart.series[i].select();
            showSeries.call(chart.series[i], {checked: true});
        }
    }
});