fix(axis): adaptive tick nicing #2688
Draft
+85
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an issue where the rendered geometries used a different domain than the axis when the domain is set to
nice
.Details
I believe this issue was introduced in #1420 when we add the adaptive ticks. The problem is that we are iteratively finding the ideal tick count for the axes, do so when the domain is static and simply set to the data domain, there is no issue because the domain never changes. However, when we apply nicing to the domain, this alters the domain which is a function of the
desiredTickCount
.So it is possible we can end up with a domain on the axes that is different from the domain used in the rendered geometries.
This is easiest to see when there is a value at
0
such that when viewing the tooltip it clearly is in the wrong location. But this affects any domain, but particularly on smaller charts or when there is congestion in the labels tending to reduce the ideal number of ticks.The easiest solution is to pass the adaptive tick count to the rendering in order to sync the tick counts, and thus the domain, between the axes and the geometries.
Before
Zight.Recording.2025-07-19.at.04.03.32.PM.mp4
After
Zight.Recording.2025-07-19.at.04.04.10.PM.mp4
Issues
Fixes #2687
Checklist
:xy
,:partition
):interactions
,:axis
)closes #123
,fixes #123
)