Kevin Lindmark
Kevin Lindmark

Reputation: 1257

chartjs - show hide specific dataset with click on element outside graph

The chartjs feature to show/hide a dataset by clicking on the legend is really nice. Is it possible to achieve the same but clicking on for instance a checkbox outside the chart canvas?

Upvotes: 0

Views: 4465

Answers (1)

Kevin Lindmark
Kevin Lindmark

Reputation: 1257

This should do the trick

chart.data.datasets.forEach(function(e) {
    e.hidden = true;
});

Upvotes: 4

Related Questions