简体   繁体   中英

Chart JS: Set Spacing Between Ticks on Y-Axis

I am building a line chart using ChartJS. I want to increase the spacing between the vertical tick marks on the Y-Axis. Here is a slice of the relevant options being passed to ChartJS. Is there a property in the ticks section that will allow me to increase the spacing between the ticks, thereby increasing the total height of the chart canvas?

lineChartOptions = {
    scales: {
      yAxes: [
        {
          id: 'y-axis-0',
          position: 'left',
          ticks: {
              ...    // <-- WHAT OPTION GOES HERE?
          }
        },

Note: It is not an option to simply decrease the height of the canvas using CSS, the canvas stretches to fill the space thereby distorting the chart.

If not much different data you can use this to set range

//EXAMPLE DATA [533,743,612,983]
ticks: {
    beginAtZero: false,
    stepSize: 100,
    max: 1000
    min: 500
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM