You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had to dig in the source code of chart.js to see what the default callback looked like.
My proposal for Changes
Replace the example in the documentation with an example that actually works:
Example
var chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
tooltips: {
callbacks: {
label: function(tooltipItem, data) {
var dataLabel = data.labels[tooltipItem.index];
var value = ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
if (helpers$1.isArray(dataLabel)) {
// show value on first line of multiline label
// need to clone because we are changing the value
dataLabel = dataLabel.slice();
dataLabel[0] += value;
} else {
dataLabel += value;
}
return dataLabel;
}
}
}
}
});
The text was updated successfully, but these errors were encountered:
Documentation Is:
The problem
When you want to alter the default tooltip for a chart, it is not clear how to do it:
https://www.chartjs.org/docs/latest/configuration/tooltip.html#label-callback
I had to dig in the source code of chart.js to see what the default callback looked like.
My proposal for Changes
Replace the example in the documentation with an example that actually works:
Example
The text was updated successfully, but these errors were encountered: