Chartjs-Format Value on mouse hover in Chart.js

0👍

The tooltip item is NOT a number but an object. See here, in the doc, how it is:

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) + "%";    
        }
    },
}

Leave a comment