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

DateTime shows too many ticks sometimes #230

Open
timwis opened this issue Apr 26, 2018 · 0 comments
Open

DateTime shows too many ticks sometimes #230

timwis opened this issue Apr 26, 2018 · 0 comments
Labels

Comments

@timwis
Copy link
Owner

timwis commented Apr 26, 2018

Works well on small screens but at larger viewports sometimes you get this:

screen shot 2018-04-26 at 5 57 30 am

width 1320.3692626953125 - tickWidth 100 = tickCount 13 but xAxis.scale(13) returns an array of 21 ticks. Yet xAxis.scale(12) returns an array of 7`. Huh?

d3 docs say:

The specified count is only a hint; the scale may return more or fewer values depending on the domain.

and

Each value is a power of ten multiplied by 1, 2 or 5

I don't feel like that explains 13 turning into 21 though.

We could either stop using xScale.ticks() and instead pick out evenly spaced items from xScale.domain(), or keep using ticks and, if its length exceeds expected length, pick out its evenly spaced items. Ticks is nice because we could pick them by date type (http://devdocs.io/d3~4/d3-scale#time_ticks).

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

No branches or pull requests

1 participant