1
I am using the following code to detect the dataset, however INDEX
comes wrong, where the value would be the Charts index and not the dataset. I need to retrieve the label of the dataset corresponding to the one I clicked on Charts.
function GetChartLabel(events, click, dataset) {
var event = events[0];
if (event) {
var activePoints = event._chart.controller.getElementsAtEvent(click);
var chartData = activePoints[0]._chart.config.data;
var idx = activePoints[0]._index;
var label = chartData.datasets[idx].label;
}
}