[Chartjs]-Chart.js HTML custom legend issues with doughnut chart

9👍

The problem is that you have only one dataset and your code use the index of legend item clicked to hide datasets[index].

On the contrary you need to hide single item data as below:

var meta = chart.getDatasetMeta(0);
var item = meta.data[index];

Check the fiddle updated: https://jsfiddle.net/beaver71/aa2n39s2/

Leave a comment