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

Negative interval number #4415

Open
Kaiyrgali opened this issue Apr 11, 2024 · 5 comments
Open

Negative interval number #4415

Kaiyrgali opened this issue Apr 11, 2024 · 5 comments
Labels
bug General bug label enhancement Enhancement to a current API

Comments

@Kaiyrgali
Copy link

Kaiyrgali commented Apr 11, 2024

@nikolasrieble Thank you for your work and the changes you have made. Unfortunately, we noticed a slight incompatibility with previous setting of the CartesianAxis. Previously, they could take negative values ​​and thereby thin them out from the end of the tick array. Now interval only accepts numbers from zero and above

<YAxis interval={-2} /> does not work

@ckifer
Copy link
Member

ckifer commented Apr 11, 2024

@Kaiyrgali previous to what, can you give more details? What version did this happen in, what version are you using?

Can you create a codesandbox example of what you had that worked, vs what does not work now?

@ckifer ckifer added pending response Pending response from the issue requester needs reproduction Use this label when an issue is submitted without proper reproduction labels Apr 11, 2024
@Kaiyrgali
Copy link
Author

Kaiyrgali commented Apr 12, 2024

@ckifer The problem probably starts with a pull request #3392

For example, in recharts version "2.0.6" the Y axis is thinned out with negative interval values
https://codesandbox.io/p/sandbox/recharts-negative-interval-v-2-0-6-k23tw4

image
image

The latest version already has a problem
https://codesandbox.io/p/sandbox/recharts-problem-negative-interval-v-2-12-4-mq5tl9

image
image

@ckifer ckifer removed pending response Pending response from the issue requester needs reproduction Use this label when an issue is submitted without proper reproduction labels Apr 12, 2024
@ckifer
Copy link
Member

ckifer commented Apr 12, 2024

That helps, thanks!

The problem is that this was undocumented behavior that the current maintainers didn't know existed and it wasn't in any test cases. Not allowing a negative number makes sense logically, so that's what was done.

We should give a way back to you to accomplish the same end result if possible

@nikolasrieble any thoughts on this?

@ckifer ckifer added bug General bug label enhancement Enhancement to a current API labels Apr 12, 2024
@nikolasrieble
Copy link
Contributor

Thank you for reporting this. I likely introduced the bug some time earlier.
Admittedly, I am surprised that this ever worked, because it contradicts my understanding of the functionality. The interval is supposed to be the amount of ticks left out.

interval = 1 --> Every second tick is shown. 
interval = 0 --> Every tick is shown. 

In this mental model, I do not understand what a negative interval means.
How would you expect it to work?

What would the difference be between

interval = -1 --> ? 
interval = -2 --> ? 

@Kaiyrgali
Copy link
Author

interval = -1 all ticks were hidden
interval = -2 and further, some ticks were hidden according to some strange logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug General bug label enhancement Enhancement to a current API
Projects
None yet
Development

No branches or pull requests

3 participants