I'm currently using Chart Js to create a chart and I want each label to have a different color instead of all labels having the same color. Is there a way to achieve this using the ticks callback function?
scales: {
xAxes: [{
gridLines: {
display: false,
},
ticks: {
callback: function(label, index, labels) {
if ('Feb 9, 2016' === label) {
fontColor: "red"; // Is it possible to do something like this?
return label+'f';
} else {
return label;
}
},
// fontColor: "red", // Can this be used here?
},
}],
yAxes: [{
display: false,
gridLines: {
display: false,
},
}],
}