Reputation: 1592
In chartjs v2 is there a way to change the numeric values on the axis to categorical text labels instead (low, medium, high) for example ?
Upvotes: 2
Views: 820
Reputation: 41065
If you want to change just the tick labels use the callback
property of ticks
. For example
...
options: {
scales: {
yAxes: [{
ticks: {
callback: function(value) {
if (value === 20)
return 'Low';
else if (value === 50)
return 'Medium';
else if (value === 80)
return 'High';
else
return '';
}
}
}]
}
}
Fiddle - http://jsfiddle.net/1gfu0tfg/
Upvotes: 2