I am creating a chart using chart.js
. I would like to remove the gridlines, but I want to keep the little pieces(
drawTicks: true)
, marked yellow in the image below.
Is this be possible?
I have tried:
gridLines: {
display: false,
drawTicks: true
}
But that is hiding all of the gridlines.
If you want to hide gridlines in Chart. js, you can use the above code. Yor will have to 'display: false' in gridLines object which is specified on the basis of Axis. You can use 'xAxes' inside scales object for applying properties on the x-axis.
When we're creating a chart using the Chart. js framework, we're going to need a canvas element. The Chart JS library relies on canvas elements. So create a canvas element in the HTML section, give it an ID of line-chart , and then close off that canvas element.
To create a chart, we need to instantiate the Chart class. To do this, we need to pass in the node, jQuery instance, or 2d context of the canvas of where we want to draw the chart.
Yes you can, to hide the gridlines without removing the little ticks you can do this :
gridLines: {
drawOnChartArea: false
}
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