Reputation:
I was wondering if there is a way to show/hide series, based on either buttons or checkbox
I would like to have all my data in one big plot, but to not make it too cluttered, I would like to decide at runtime what data to display.
Is this possible? Is there an example that I can use as template? I have about 12 different data sets; which means that I need also to figure out how to load different data from different files, without write 12 different get data functions.
Upvotes: 1
Views: 1778
Reputation: 19103
Highcharts has an API call for doing exactly what you want. The call you want is series.hide or series.show.
For example, the following code (from the highchars own examples) will toggle a series on an off:
var series = chart.series[0];
if (series.visible) {
series.hide();
$button.html('Show series');
} else {
series.show();
$button.html('Hide series');
}
http://api.highcharts.com/highcharts#Series.show
Upvotes: 1