Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uneven tick spacing with maxTicksLimit and min options with Chart.js 3 #8806

Closed
ankane opened this issue Apr 3, 2021 · 4 comments · Fixed by #8811
Closed

Uneven tick spacing with maxTicksLimit and min options with Chart.js 3 #8806

ankane opened this issue Apr 3, 2021 · 4 comments · Fixed by #8811
Milestone

Comments

@ankane
Copy link
Contributor

ankane commented Apr 3, 2021

Hey, congrats on the 3.0 release! Came across a possible issue with the interaction of the maxTicksLimit and min options.

Expected Behavior

Even tick spacing (like in Chart.js 2)

Current Behavior

Uneven tick spacing

Steps to Reproduce

https://codepen.io/ankane/pen/LYxyXEN

There's even spacing when the min option is removed (and has the same min value in the example). There's also even spacing if maxTicksLimit is increased by one in the example (and has less than maxTicksLimit ticks).

Noticed this with both bar and line charts.

Context

Ran into this trying to upgrade Chartkick to Chart.js 3

Environment

  • Chart.js version: 3.0.1
  • Browser name and version: Firefox 87.0

Edit: Also, it's probably on your list, but the Codepen in the new issue template could use upgrading to Chart.js 3

@etimberg
Copy link
Member

etimberg commented Apr 3, 2021

A quick analysis says that it was introduced in beta.13

Based on the release notes, only #8569 seems to be applicable.

@etimberg
Copy link
Member

etimberg commented Apr 3, 2021

Interestingly, if beginAtZero is used instead of min: 0 it works fine.

@etimberg
Copy link
Member

etimberg commented Apr 4, 2021

@ankane a fix for this was released in 3.0.2

@ankane
Copy link
Contributor Author

ankane commented Apr 4, 2021

That was super fast. Just tried it and works great. Thanks @etimberg and @kurkle!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants