Chartjs-How can I remove the grid line in the background of the line chart?

1👍

Please take a look at the documentation. You can disable gridlines in the options (which you will have to add)
https://www.chartjs.org/docs/2.9.4/axes/cartesian/#common-configuration

options: {
  scales: {
    yAxes: [
      gridLines: {
        display: false
      }
    ],
    xAxes: [
      gridLines: {
        display: false
      }
    ]
  },
  legend: {
    display: false
  }
}

V3:

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

0👍

Here is the way to remove the grids (lines) in the background of the chart in version 4 (Time Cartisian axis):

scales: {
          x: {
            type: 'time',
          time: {
              displayFormats: {
                month: 'dd MMM yy'
              },

              unit: 'day'
            },
            
            ticks: {
              color: "black",
                            
            },
           
            **grid {
              DrawOnChartArea : false
            }**,
            
          },

        y: {
            type: 'linear',
            position:'left'
            ticks: {
              color: "black"
                   },
            grid:{
            display = false
                }
          }
     }

Leave a comment