Hi,
When i click on the legend items they are toggled in the chart. strikethrough items are not rendered.
How can i do the same thing by using chart instance, instead of clicking on legend items?
some code like;
chart.hideLabel('RGI');
chart.showLabel('RGI');
For me it worked to use this:
Where 1 is the index of RGB in the dataset.
@mennodekker is right. Just one point: instead of null, better to use false.
The reason is that if the dataset is hidden in the first place, programmatically setting hidden to null won’t actually show the dataset.
I’m actually facing a similar issue. I”ve make a custom legend component and I’m able to show/hide using the above codes. However, this only works for bar chart. It raise the following exception when using it with donut chart:
TypeError: Cannot read property '_meta' of undefined at Chart.getDatasetMeta (core.controller.js:656)
Have anyone faced a similar issue please?