Chartjs-How I can get label name when user click on particular area in doughnut chart.js? I am not able to find the index of selected area for chart.js

0👍

I got it. it’s working now.

options: {
 onClick: (e,legend) => {
  console.log(legend[0].index);
  alert(chart.data.labels[legend[0].index]);
 },
}

Leave a comment