3👍
Try like that:
var legendClick = Chart.defaults.global.legend.onClick;
Chart.defaults.global.legend.onClick = function(e, legendItem) {
console.log(legendItem);
legendClick.call(this, e, legendItem);
};
legendItem contains the index of the bar that was clicked.
legendClick.call(this, e, legendItem) performs the default click handler.
- [Chartjs]-Chart js with angular2 loading dynamic data only after zoomin
- [Chartjs]-How can I show text over a ChartJS bar chart?
Source:stackexchange.com