-
Notifications
You must be signed in to change notification settings - Fork 107
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
Axis with d3.scaleTime scale and specified number of ticks is apparently mislabelled #6
Comments
Sorry, my mistake. This is documented behaviour:
Is there any way to specify the number of ticks while retaining the default tick format? |
So, one can do it like this:
That feels a little bit convoluted, though. |
Yeah, I think this is a bug. The problem is that the time scale’s tickFormat method isn’t consistent with the other scales, which all take a suggested count as the first argument. In D3 3.x this wasn’t an issue because the time scale ignored all arguments to scale.tickFormat. So, if you specified a count to axis.ticks, it would affect scale.ticks, but not scale.tickFormat (because a time scale always renders times the same way, dependent only on the input time and not the number of ticks). We should retain that behavior for D3 4.0. |
An axis that uses a date scale (
d3.scaleTime
) and has a specified number of ticks (.ticks(6)
) is apparently mislabelled. All the ticks are labelled with the string"6"
.See demo here.
The text was updated successfully, but these errors were encountered: