0👍
The tooltip item is NOT a number but an object. See here, in the doc, how it is:
- (v3) https://www.chartjs.org/docs/latest/configuration/tooltip.html#tooltip-item-context
- (v2) https://www.chartjs.org/docs/2.9.4/configuration/tooltip.html#tooltip-item-interface
I assume you are using version 2 (based on your config), you could try:
tooltips:
{
callbacks:
{
label: function(tooltipItem, data)
{
const title = data.labels[tooltipItem.index];
const dataset = data.datasets[tooltipItem.datasetIndex];
const value = dataset.data[tooltipItem.index];
return title + ': ' + Number(value).toFixed(2) + "%";
}
},
}
Source:stackexchange.com