Chartjs-How to format the left legend on chartjs

0👍

var chart = new Chart(ctx, {
    type: 'line',
    data: data,
    options: {
        scales: {
            yAxes: [{
                ticks: {
                    // Include a dollar sign in the ticks
                    callback: function(value, index, values) {
                        return '$' + value;
                    }
                }
            }]
        }
    }
});

This is a sample code to format the y axis value from the documentation page of chartjs. You can use this callback to format your labels.

Leave a comment