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

Sometimes the lowest threshold is missing #67

Closed
mbostock opened this issue Jan 11, 2023 · 0 comments · Fixed by #68
Closed

Sometimes the lowest threshold is missing #67

mbostock opened this issue Jan 11, 2023 · 0 comments · Fixed by #68
Labels
bug Something isn’t working

Comments

@mbostock
Copy link
Member

mbostock commented Jan 11, 2023

E.g., if the domain is

[-149.76192742819748, 321.19300631539585]

and 14 ticks are desired, then the estimated tick step is 50

tickStep(-149.76192742819748, 321.19300631539585, 14)

and hence the resulting “niced” domain is

[-150, 250]

which when passed to ticks as

ticks(-150, 250, 14)

produces

[-140, -120, -100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240]

and notice that –140 is greater than the original minimum. Related d3/d3-scale#209

We should be using d3.nice instead. d3/d3-array#174

ticks(...nice(-149.76192742819748, 321.19300631539585, 14), 14)

which produces

[-150, -100, -50, 0, 50, 100, 150, 200, 250, 300, 350]

although we should drop any threshold greater than or equal to the maximum.

@mbostock mbostock added the bug Something isn’t working label Jan 11, 2023
@mbostock mbostock mentioned this issue Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working
Development

Successfully merging a pull request may close this issue.

1 participant