5👍
options : {
tooltips: {
enabled: true,
mode: 'single',
callbacks: {
label: function (tooltipItems, data) {
return tooltipItems.yLabel + " %";
}
}
}
- [Chartjs]-How to make react-chartjs-2 responsive on mobile?
- [Chartjs]-Hide empty bars in Grouped Stacked Bar Chart – chart.js
2👍
I too faced the same issue 3+
plugins: {
tooltip: {
yAlign: 'bottom',
callbacks: {
label(tooltipItems: any) {
return `${tooltipItems.formattedValue} %`
}
}
}
}
- [Chartjs]-How to add a point to chart.js line chart?
- [Chartjs]-Creating chart.js chart directly to PNG in Node js?
1👍
This code works also for Pie Charts:
tooltips: {
enabled: true,
mode: 'single',
callbacks: {
label: function (tooltipItems, data) {
var i = tooltipItems.index;
return data.labels[i] + ": " + data.datasets[0].data[i] + " %";
}
}
}
- [Chartjs]-Chart.js bar chart: show tooltip on label hover
- [Chartjs]-Chart.js – Color specific parts of the background in a line chart
0👍
Update: This is for Chartjs Version – 3.9.1
tooltip: {
callbacks: {
label: function (context) {
return context.label + ': ' + context.formattedValue + '%';
}
}
}
With this you can attach suffix or prefix to label value in tooltip.
- [Chartjs]-Chartjs Datasets overlapping and z-index
- [Chartjs]-Change border color on legend in Chart.js
Source:stackexchange.com