I am developing a chart in chart.js and I want to show dotted gridlines like shown in the image.
You can edit your dataset display in your chart options :
options: {
scales: {
// The following will affect the vertical lines (xAxe) of your dataset
xAxes: [{
gridLines: {
// You can change the color, the dash effect, the main axe color, etc.
borderDash: [8, 4],
color: "#348632"
}
}],
// And this will affect the horizontal lines (yAxe) of your dataset
yAxes: [{
gridLines: {
borderDash: [8, 4],
color: "#348632"
}
}]
}
}
Now that you know how to do it, just change it as how you want it to be.
Check Grid Line Configuration on Chart.js documentation to see what is editable.
If needed, here are a working example on this jsFiddle and its result :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With