Chartjs-Custom text in tooltip and legend: ChartJs

1👍

Fixed it

{
...
tooltipTemplate: function (label) {
                        return customTooltip(label);
                    }

});

function customTooltip (label) {
                    if (label.label.length > 10) {
                        label.label = label.label.substring(0,10)+'...';
                    }
                    return label.label+': '+label.value+'%';
}

Don’t know if this is the right code. But it did what i wanted

Leave a comment