I am trying to show dataset labels on ChartJS tooltips. It works fine by setting:
Chart.defaults.global = {
multiTooltipTemplate: "<%= datasetLabel %> - <%= value %>"
}
. But when a label changes, it doesn't get updated on tooltips and the previous label is still shown:
myLineChart.datasets[0].label = 'new label';
myLineChart.update();
Any Idea?
Instead of try like that, you just put your code within chart options. It will work fine.
example:
var radarOptions = {
multiTooltipTemplate: "<%= datasetLabel %> - <%= value %>"
}
var ctx = document.getElementById("radarChart").getContext("2d");//radarChart is the canvasid for radar chart//
var myNewChart = new Chart(ctx).Radar(radarData, radarOptions);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With