score:2

Accepted answer

you can set the defaults for this. you can set it in the scale default so it does it for all the chart types and scales. if you specifically want to hide the x axis gridlines only you need to set it on chart type level.

chart.defaults.scale.gridlines.display = false // hides all the gridlines in all charts for all axes
chart.defaults.line.scales.xaxes[0].gridlines = {
  display: false
} // hides only the x axes gridlines in all line charts

var options = {
  type: 'line',
  data: {
    labels: ["red", "blue", "yellow", "green", "purple", "orange"],
    datasets: [{
        label: '# of votes',
        data: [12, 19, 3, 5, 2, 3],
        borderwidth: 1
      },
      {
        label: '# of points',
        data: [7, 11, 5, 8, 3, 7],
        borderwidth: 1
      }
    ]
  },
  options: {
    scales: {
      yaxes: [{
        ticks: {
          reverse: false
        }
      }]
    }
  }
}

var ctx = document.getelementbyid('chartjscontainer').getcontext('2d');
new chart(ctx, options);
<body>
  <canvas id="chartjscontainer" width="600" height="400"></canvas>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.9.4/chart.js"></script>
</body>


Related Query

More Query from same tag