Is there a way to customize the color of the X and Y axes labels in Chart.js?
I attempted to use the fontColor
property within scaleLabel
, but I suspect I may be placing it incorrectly?
I experimented with placing it under scale
as suggested by the source code, which can be seen here. I also tried within scales
and even inside xAxes
.
var options = {
type: 'bar',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: 'red',
borderWidth: 1
}]
},
options: {
scale: {
scaleLabel:{
fontColor: 'red'
}
},
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
}
};
https://i.sstatic.net/U1mgk.jpg
I have consulted the documentation, but it doesn't provide clear guidance. Unfortunately, Chart.js lacks sufficient examples, making it challenging to navigate at times...