Chartjs-How to limit xAxes and yAxes in React Chart JS?

1👍

To solve your problem, define options as follows.

const options = {
  responsive: true,
  scales: {
    x: {
      ticks: {
        maxTicksLimit: 9
      }
    },
    y: {
      ticks: {
        maxTicksLimit: 4
      }
    }
  }
};

For further information, consult Tick Configuration Options from the Chart.js documentation.

Please take a look at your amended CodeSandbox and see how it works.

Leave a comment