Uh oh!
There was an error while loading. Please reload this page.
Avoid tight daily labels on axes with rangebreaks when using "day of week" pattern - #4695
Conversation
nicolaskruchten
commented
Mar 27, 2020
archmoj
commented
Mar 27, 2020
@nicolaskruchten thanks very much for posting the image related to the ( old ) undesirable behaviour. |
| if(ax.dtick === 2 * ONEDAY) ax.dtick = ONEDAY; | ||
| else if(ax.dtick === 3 * ONEDAY) ax.dtick = 7 * ONEDAY; | ||
| ax.dtick = roundDTick(roughDTick, ONEDAY, [1, 1.001, 7, 14]); | ||
| if(ax.dtick !== ONEDAY) ax.dtick = 7 * ONEDAY; |
There was a problem hiding this comment.
Is this different from just saying roundDTick(roughDTick, ONEDAY, [1, 7, 14])? The underlying function is Lib.roundUp so I'd expect anything too big for 1 would already bump up to 7. Also I think this would convert 2-week ticks into 1-week?
There was a problem hiding this comment.
Also I think this would convert 2-week ticks into 1-week?
Doog eye. Fixed in 79b6d95.
But we still need to fix something possibly in Lib.dateTick0 to compute dtick on those reversed cases.
There was a problem hiding this comment.
again though, is this different from just roundDTick(roughDTick, ONEDAY, [1, 7, 14])?
There was a problem hiding this comment.
I think that is different. The issue was almost related to numbers close to 1 (e.g. 2) not those close to 7. Anyway it seems there is no more need for that hacy roundingSet as the logic is changed in the commits below.
archmoj
commented
Mar 27, 2020
@nicolaskruchten would you mind testing the updated demo in the PR description. |
alexcjohnson
left a comment
There was a problem hiding this comment.
💃 sometimes the simple solution is the best 😅

Demo
Follow up of #4614 and #4688:
Commit c340efc exercised 2 -> 7 rounding which leads to following commits.
As a result we only round
dtickto 1 if it is really close to 1.@plotly/plotly_js