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

A tick is sometimes rendered outside of the user-defined max axis limit when includeBounds=false #11083

Closed
CodingMarco opened this issue Jan 22, 2023 · 0 comments · Fixed by #11116

Comments

@CodingMarco
Copy link
Contributor

CodingMarco commented Jan 22, 2023

Expected behavior

When includeBounds on the axis of a line chart is set to false and min and max of the axis are defined, there shouldn't be any ticks outside of the defined axis limits.

Current behavior

In some cases, a tick is created outside of the user-defined max axis limit. This especially happens with small axis limits (in my code sample: min: 2.404e-8, max: 2.4141e-8).

Reproducible sample

https://codepen.io/CodingMarco/pen/vYadxqv

Optional extra steps/info to reproduce

No response

Possible solution

Please see my proposed fix: CodingMarco@1f1fd79.
This commit would fix the issue, however I'm looking for feedback if this is the correct way of fixing it.
Maybe another option would be to fix the calculation of numSpaces, but I think the advantage of my proposed fix is that it works in all edge cases.

All currently existing tests run successfully with my fix.

Context

When plotting eye diagrams commonly used to characterize digital signals, it looks very ugly if there is space next to the eye diagram (without the fix, see left image). With my proposed fix, it looks much better (see right image).

chart.js version

v4.2.0

Browser name and version

No response

Link to your project

No response

CodingMarco added a commit to CodingMarco/Chart.js that referenced this issue Feb 5, 2023
@etimberg etimberg added this to the Version 4.3.0 milestone Feb 10, 2023
etimberg pushed a commit that referenced this issue Feb 10, 2023
* Fix: don't generate ticks > max if max is specified (#11083)

* Add test "Should not generate any ticks > max if max is specified" (#11083)
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.

2 participants