score:1

you can make use of the drawticks and count propertys to achieve what your want.

live example:

var options = {
  type: 'line',
  data: {
    labels: ["red", "blue", "yellow", "green", "purple", "orange"],
    datasets: [{
      label: '# of votes',
      data: [12, 19, 3, 5, 2, 3]
    }]
  },
  options: {
    scales: {
      y: {
        ticks: {
          count: 5,
          padding: 10
        },
        grid: {
          drawticks: false
        }
      },
      x: {
        ticks: {
          padding: 10
        },
        grid: {
          drawticks: 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/3.4.0/chart.js"></script>
</body>


Related Query

More Query from same tag