1π
β
In order to add custom label, you should attach a callback as below :
var chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
scales: {
yAxes: [{
ticks: {
// Include a dollar sign in the ticks
callback: function(value, index, values) {
return '$' + value;
}
}
}]
}
}
});
Important thing to remember here is that, if the callback returns null
or undefined
, the associated grid line will be hidden
Source:stackexchange.com