How to change the width and the color of the x-axis (horizontal axis) in Chartjs? It seems to work using zeroLineColor
and zeroLineWidth
for the y-axis (vertical one), but it does not work for the x-axis.
If we add:
ticks: {
beginAtZero: true
}
It works as expected, but I don't want the vertical ticks to start from 0.
Is there a way to make this happen?
scales: {
xAxes: [{
gridLines: {
zeroLineColor: 'black', // WORKS
zeroLineWidth: 2 // WORKS
},
display: true
}],
yAxes: [{
gridLines: {
zeroLineColor: 'black', // DOES NOT WORK
zeroLineWidth: 2, // DOES NOT WORK
},
id: 'y-axis-0',
display: true,
ticks: {
// beginAtZero: true // This is what I dont't want to use
}
}]
}
This is the result I get with the previous code:
As you can see, the x-axis is displayed without changes in color or width.
I'm using version 2.9.4 of the Chartjs library.