I want to add a '%' to the hover concatenated to my data. So let's say I have:
const data = {
maintainAspectRatio: false,
responsive: false,
labels: ["a", "b"],
datasets: [
{
data: [50, 50],
backgroundColor: ['rgba(12, 29, 213, 0.89)', 'rgba(49, 58, 52, 0.89)'],
hoverBackgroundColor: ['#1f2bae','#242825']
}
]
};
it displays like this:
Now I just want a % concatenated to the 50. So my question is how do I do this given that I always have the % as data but just as a number without the % ?
Edit: my working solution works like this:
tooltip: {
callbacks: {
label: function(data ) {
var label = data.dataset.label || '';
if (data.parsed.y !== null) {
label += data.parsed+'%';
}
return label;
}
}
}