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..
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});
}
}
});
You can iterate over each series inside the chart and call show()
or hide()
function, depending on what you want to do. This solution is similar to the previous answers, but calling using the show
/hide
functions
i = 0;
while (i < chart.series.length) {
if (chart.series[i].visible === false) { // here you can filter the visible series
chart.series[i].select();
chart.series[i].show(); // here you can call hide()
i++;
return;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With