Reputation: 55
i'm using chart.js 3.0 i want to add the euro sybol on each y-axis value. with this code:
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
scales: {
y: {
ticks: {
// Include a dollar sign in the ticks
callback: function(value, index, ticks) {
return '$' + value;
}
}
}
}
}
});
i add the dollar symbol on each y-axis value, I want to show the euro symbol (€), but if i use this code:
callback: function(value, index, ticks) {
return '€' + value;
}
i get a bad result, i get the symbol ? instead of the € symbol how i can fix it?
Upvotes: 2
Views: 559
Reputation: 26170
Instead of using the Euro symbol, try to use its Unicode as follows.
options: {
scales: {
y: {
ticks: {
callback: v => v + '\u20AC'
}
}
}
Upvotes: 3