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

Log scales may generate no ticks for small domains. #44

Closed
mbostock opened this issue Dec 29, 2015 · 6 comments
Closed

Log scales may generate no ticks for small domains. #44

mbostock opened this issue Dec 29, 2015 · 6 comments

Comments

@mbostock
Copy link
Member

If the difference between the smallest and largest values in the domain is small relative to their absolute value, then log.ticks can return the empty array. For example:

d3_scale.log().domain([42, 43]).ticks(); // []

In this case, it’d probably be best for the log scale to fallback to the behavior of a standard linear scale. Although, it’s probably appropriate to continue to use an exponential tick format?

@mbostock mbostock changed the title log.ticks() returns no ticks for small domains. Log scales may generate no ticks for small domains. Dec 29, 2015
@mbostock
Copy link
Member Author

(Of course in this case the log scale is essentially equivalent to a linear scale, but it’d be nice if the log scale still did the right thing.)

@cbryan-risklens
Copy link

Hey @mbostock, it looks like #49 and #129 were created to fix this issue. If the code is to your satisfaction, can you merge one of them? My team is running into this issue.

@rostislavprovodenko
Copy link

This issue is still present in 5.7.2:
d3.scaleLog().domain([41, 42]).ticks()
returns an empty array. please recommend a workaround

@shanmuksai
Copy link

This issue is still present in 5.16.0:
d3.scaleLog().domain([41, 42]).ticks()
now i was implicity forming scale with
d3Scale.scaleLog().domain([41, 42]).ticks()

@Fil
Copy link
Member

Fil commented Jun 19, 2020

It was fixed in d3-scale@3 which is not yet part of the D3 bundle. Will ship with d3@6. In the meantime you could try require("d3-scale@3")

@shanmuksai
Copy link

@Fil
Thanks for your response for the response, for now, I was using "d3-scale" for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

5 participants