0

enter image description here

I am trying to find an option within chart.js that allows me to modify the space between bars and labels, but so far have been unsuccessful. I have tried the options under https://www.chartjs.org/docs/latest/charts/bar.html.

1 Answer 1

3

You can use ticks.padding to define the offset of the tick labels from the axis. In you case, it needs to be defined inside the options.scales.yAxis as follows:

options: { scales: { yAxes: [{ gridLines: { drawTicks: false }, ticks: { padding: 5 } }], 
Sign up to request clarification or add additional context in comments.

2 Comments

Unfortunately this didn't work, but thanks for the advice. I tried both padding: 5 and padding: 0, but it didn't change the spacing. After reading the documentation I believe this changes the spacing of the ticks, not of the labels, so it makes sense nothing was changed.
After messing with it some more I realized that these numbers were increased padding, so putting padding: 5 doesn't set the padding to 5, it increases the padding by 5. As such using a negative number like padding: -20 accomplished my goal. Thanks for the help.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.