Ask Your Question
3

How can I decrease the vertical spacing on the Y axis of a chart created with chartjs?

asked 2023-06-25 07:20:55 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-06-25 07:46:02 +0000

plato gravatar image

You can decrease the vertical spacing on the Y axis of a chart created with Chart.js by tweaking the ticks configuration in the options object. Here's an example:

var options = {
  scales: {
    yAxes: [{
      ticks: {
        stepSize: 1, // set the interval to 1
        min: 0 // set the minimum value to 0
      }
    }]
  }
};

In this example, we set stepSize to 1 to specify that the Y axis ticks should be spaced apart by 1 unit (for example, 0, 1, 2, 3, etc.). We also set min to 0 to ensure that the minimum value on the Y axis starts at 0. You can adjust these values according to your data and visualization requirements.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-25 07:20:55 +0000

Seen: 9 times

Last updated: Jun 25 '23