In a chart options configurations I can make my own label. This is for a bar chart:
tooltips: {
callbacks: {
label: function(tooltipItem) {
var label = tooltipItem.yLabel;
return 'Scans : ' + label;
}
}
}
But for a pie chart all the tooltipItems are empty or 0 values. What argument can i use to get only the value of where i am hovering in my pie chart? (The value of that specific slice)
Try this:
tooltips: {
mode: 'label',
callbacks: {
label: function(tooltipItem, data) {
var indice = tooltipItem.index;
return data.labels[indice] +': '+data.datasets[0].data[indice] + '';
}
}
},
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