[Chartjs]-How to hide grid lines in graphs in React chart js 2

1๐Ÿ‘

I run it on "react-chartjs-2": "^5.2.0", on React TS project:
Just add In option for your chart grid display:false

const options = {
    scales: {
        y: {
            grid: {
                display: false
            }
        },
        x: {
            grid: {
                display: false
            }
        },
    }
}
    
<Line options={options} data={data}/>

0๐Ÿ‘

Tried your snippet but its not working in react-chartjs-2 v5.2

Solution: you can simply raplace xAxes, yAxes with x,y and instead of gridLines with grid inside scales

scales: {
    x: {
      grid: {
        display: false
      }
    },
    y: {
      grid: {
        display: false
      }
    }
  }

I removed gridlines here: removed gridlines here

Leave a comment