Skip to content

Conversation

nickofthyme
Copy link
Collaborator

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

Notice as the tick count changes, either increase or decrease, the rendered geometries never jump to align with the new axes scales.

After

Zight.Recording.2025-07-19.at.04.04.10.PM.mp4

Notice as the tick count changes, either increase or decrease, the rendered geometries jump to align with the new axes scales.

Issues

Fixes #2687

Checklist

  • The proper chart type label has been added (e.g. :xy, :partition)
  • The proper feature labels have been added (e.g. :interactions, :axis)
  • All related issues have been linked (i.e. closes #123, fixes #123)
  • Unit tests have been added or updated to match the most common scenarios
  • The proper documentation and/or storybook story has been added or updated

@nickofthyme nickofthyme added :axis Axis related issue :data Data/series/scales related issue :xy Bar/Line/Area chart related labels Jul 19, 2025
@elastic-datavis
Copy link
Contributor

✅ Successful Deployment (build#4921) - 09e2a1e

@nickofthyme nickofthyme marked this pull request as draft July 24, 2025 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:axis Axis related issue :data Data/series/scales related issue :xy Bar/Line/Area chart related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Axis] Incorrect x axis ticks on xy charts
1 participant