-
Notifications
You must be signed in to change notification settings - Fork 180
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
Interval-aware default ticks/tick formats #932
Comments
I’ve retitled this issue to describe the more general issue. |
A related typical use case is Plot.tickX([new Date(2001, 0, 1), new Date(2001, 1, 1)]).plot({
x: {interval: "day", tickRotate:40},
height: 70, marginBottom: 50}) Since the interval is "day" we could have a stricter tickFormat than the default "multiscale". cc: @mootari |
Related feedback from Misha Tsvelik: https://vimeo.com/829300247/91d6c7eeef This issue applies to ticks, and not just tick formats: for example if the data is just integers, then we wouldn’t want to show ticks at 0.1, 0.2, 0.3, etc., or if the data is just months, we don’t want to show weekly ticks. I guess we would need some heuristic that looks at the channel values and guesses what the interval is; if we guess successfully, then we can choose an appropriate tick interval and accompanying tick format. |
I got this working in #1790, but messy: : tickFormat === undefined && data && isNumeric(data) && scale.interval?.[intervalDuration]
? format(`.${`${scale.interval?.[intervalDuration] % 1}`.length - 2}f`) |
When the data only contains integers, it would be great if the default tickFormat would not do "1.0, 2.0, 3.0"… but rather "1, 2, 3".
In #849 I hoped that indicating an integer interval would be used, in this case to infer an intent of only having integers. (Similarly, if we used interval: d3.utcYear we'd rather format the ticks as "%Y", and d3.utcMonth would result in a default of "%Y-%m" or something.)
Example: the test plot integer-interval.js (svg) should have inferred an integer tickFormat for the x axis. (See also the discussion here.)
Also related to #768
The text was updated successfully, but these errors were encountered: