[Chartjs]-How to add padding to the vertical scale (X-axis) in Chart.js?

2👍

Add this to your options parameter:

options: {
   scales: {
       x: {
        ticks: {
           padding: 10
        }
    }
 }

12👍

Late to the game here, but the solution with latest Chart.js is to include this in your options parameter:

{
  scales: {
    xAxes: [
      {
        ticks: {
          padding: 20
        }
      }
    ]
  }
}

2👍

Pass value to ‘tickMarkLength’ in
options–> scales–> xAxes–> gridLines

xAxes: [{
  gridLines: {
   tickMarkLength: 10
},

1👍

The correct answer is the following for version 2.8:

options: {
    scales: {
        xAxes: [{
            ticks: {
                padding: 100
            }
        }], 
    }
}

0👍

For echarts version 5:

grid: {
    left: '3%',
    right: '10%',
    bottom: '3%',
    containLabel: true
  },

Leave a comment