Making sure gridlines do not cross y-axis with ChartJS

๐Ÿ‘:1

Set options.scales.yAxes[0].gridLines.drawTicks to false and and some padding in gridLines.ticks.padding:

{
  type: 'bar',
  data: {
    labels: ['Q1', 'Q2', 'Q3', 'Q4'],
    datasets: [{
      label: 'Users',
      data: [50, 60, 70, 180]
    }]
  },
  options: {
    scales: {
      yAxes: [{
        gridLines: {
          drawTicks: false,
        },
        ticks: {
          padding: 8,
        }
      }]
    }
  }
}

bar chart without ticks

Leave a comment