You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This generates ticks every three hours, where d3.timeHour is the interval and 3 is the step (deprecated in 16d5789 but not removed), but the ticks are all formatted as the string “3” because when you call
time.tickFormat(d3.timeHour,3)
d3.timeHour is interpreted as the count which is ignored, and 3 is interpreted as the specified, thus making it equivalent to
d3.timeFormat(3)
which gives you a function that just returns the string “3”.
It appears that the desired behavior is that you use interval.every instead:
This does produce the desired result, but it means that you have to call axis.tickFormat separately if you want to also specify the tick format, and you also have to construct the d3.timeFormat explicitly (or d3.utcFormat with d3.scaleUtc, which is another opportunity for error). If you try to pass the specifier and use interval.every:
Given that the step was deprecated way back in 2016 (1.0.1), and that we just released 3.0.0 (but not yet d3@6.0.0), I’ll argue that this is a bug, and that we shouldn’t still be supporting the secret step argument to time.ticks, and that instead the second argument should be ignored so that it can be compatible with time.tickFormat and hence axis.ticks.
This is closely related to #57 and d3/d3-axis#6. For example:
This generates ticks every three hours, where d3.timeHour is the interval and 3 is the step (deprecated in 16d5789 but not removed), but the ticks are all formatted as the string “3” because when you call
d3.timeHour is interpreted as the count which is ignored, and 3 is interpreted as the specified, thus making it equivalent to
which gives you a function that just returns the string “3”.
It appears that the desired behavior is that you use interval.every instead:
This does produce the desired result, but it means that you have to call axis.tickFormat separately if you want to also specify the tick format, and you also have to construct the d3.timeFormat explicitly (or d3.utcFormat with d3.scaleUtc, which is another opportunity for error). If you try to pass the specifier and use interval.every:
Then you get an error
because it tries to call interval.every again on the interval returned by interval.every, which is nonsensical (and not supported).
The text was updated successfully, but these errors were encountered: