Chartjs-How to add Thousand separator in pie chart tooltips of charts.js

0👍

Try this:

function(label){
    //Assuming the label.value is a number
    let amount = label.value.toFixed(2);
    let tooltipLabel =  label.datasetLabel + ': ' + amount.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");

    return tooltipLabel; 
}

Leave a comment