0👍
✅
You can use the prototype method .getElementAtEvent(e)
to get the element clicked on like so
onClick: function(evt, element) {
var activePoints = bar_chart.getElementAtEvent(evt);
console.log(activePoints[0]._model.datasetLabel);
}
Or you can attach it as an event handler on the chart element
bar_ctx.onclick = function(evt) {
var activePoints = bar_chart.getElementAtEvent(evt);
console.log(activePoints[0]._model.datasetLabel);
};
Source:stackexchange.com