You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
See Example. I would expect when the xAxis is set to type='number' that it would display ticks just like when the yAxis is set to type number. It distributes ticks evenly without respect to where data is clumped or sparse. I have tried everything to figure this out.
What is expected?
Evenly spaced ticks just like the yAxis
What is actually happening?
Unevenly spaced ticks, seemingly based upon where the data is. Its like the type='number' has no impact
Environment
Info
Recharts
v2.12.2
React
18
System
macOS, Sonoma 14.2.1
Browser
Vivaldi 6.5.3206.59
Setting the interval to "equidistantStartEnd" does not work
The text was updated successfully, but these errors were encountered:
equidistantStartEnd does not exist, equidistantPreserveStart is the only current "equidistant" implementation.
You can read a description of this implementation in this PR #3392
@nikolasrieble might be able to add more here, but from my understanding the behavior with a number axis is because it is attempting to use D3 "nice" ticks, which require the domain to be nice numbers.
If I set the domain to ['dataMin', 'auto'] instead of dataMax, it will extend the domain slightly and be able to create 5 ticks nicely distributed across the axis.
But.. this happens regardless of the interval setting. Will wait for someone else who knows this better to reply 😅
One of the difficulties in working with and developing recharts is the interaction effects of all the properties. These are neither (a) (well) documented or (b) fully known to us, who maintain and develop recharts.
My first assumption is that one of the arguments interacts with the effect of the interval.
Workaround
And if I remove the domain from your sandbox, it indeed works as expected.
We are always looking for contributors
I would classify this behaviour as a bug, and would suggest to look more into the interaction of domain and interval setting. We are always looking for new contributors. Would you like to pick this up?
@nikolasrieble Nice to meet you! Thanks for the response and while your solution works for the dataset provided in the sandbox it doesn't work for the exact data set I'm working with for my production app. I should have supplied the exact data set.
Here's a more specific example where removing the domain while having equidistantPreserveStart still doesn't work. Example
I unfortunately don't have the capacity to work on this right now.
Reproduction link
Steps to reproduce
See Example. I would expect when the xAxis is set to type='number' that it would display ticks just like when the yAxis is set to type number. It distributes ticks evenly without respect to where data is clumped or sparse. I have tried everything to figure this out.
What is expected?
Evenly spaced ticks just like the yAxis
What is actually happening?
Unevenly spaced ticks, seemingly based upon where the data is. Its like the type='number' has no impact
Setting the interval to "equidistantStartEnd" does not work
The text was updated successfully, but these errors were encountered: