[Chartjs]-How can I remove the grid lines in Chart.js

1๐Ÿ‘

โœ…

You might check a chart.js sample. From there I found some deviations in the object setup of your example

        var config = {
            type: 'line',
            data: {
                datasets: [{
                    // Here starts your snippet
                }]
            },
            options: {
                // The options are outside of the datasets property
                scales: {
                    x: {
                        gridLines: {
                          display: false
                        }
                    },
                    y: {
                        gridLines: {
                          display: false
                        }
                    }
                }
            }
        };

Edit 1: updated the scales with the gridLines property

0๐Ÿ‘

You can use below code to remove gridlines and if you want to enable X and Y axis its useful

 gridLines: {
                  display: true,
                  zeroLineColor:'white',
                  color:'transparent'
                }

Leave a comment