I have a line chart where data is displayed as point elements depending on the X axes (time axis) label.
// Config chart
const config = {
type: "line",
data: {
labels: ['ene.', 'feb', 'mar.', 'abr.', 'may.', 'jun.', 'jul.', 'ago.', 'sep.', 'oct.', 'nov.', 'dic.'],
datasets // ex --> [{ x: 'jun.', y: 90 }]
},
options: {
tooltips: {
callbacks: {
title: function(context) {
console.log(context); // Returning wrong xLabel
}
}
}
}
}
The problem is when it shows the tooltip of, for example, June it takes it as index 3 so the title tooltip (xlabel) is shown as “April”.
How could I get the proper label on the tooltip, not depending on the index?