-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fixup weekly and quarterly period label positioning and with rangebreaks #5089
Merged
Merged
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
1a09b58
center weekly labels on weekend rangebreaks
archmoj 9fce7ad
improve quarters and year period label positioning
archmoj 8928851
reduce min quarter constant for the edge case of Feb-Mar-Apr
archmoj ea6eca1
add logic for special case of weeks and quarters
archmoj 37a0840
use tickfromat getter and add question comment
archmoj e0bd026
more fixups for period tickformat
archmoj 6fb0133
remove comment
archmoj f907f2a
revise period lengths on axes with rangebreaks
archmoj fa5d2e3
do not recalculate periodLength when zero
archmoj b318e8b
reduce sampling
archmoj beed352
should not move by a week or quarter when the labels are not weekly o…
archmoj 104ae5e
use formatter in the variable name of the entire tickformat
archmoj 7febd59
add tests for auto labels and rangebreaks
archmoj 636531b
add hovertemplate to make debugging easier in future
archmoj dddcaa8
make week and quarter labels mode readable in tests
archmoj b32b5a4
add tests for period labels on axes with reversed ranges
archmoj 350a10a
position quarters in period mode - case of dtick set to M6
archmoj 50a3451
skip labels with identical text as previous label
archmoj 2920e31
ensure new label positions remains between ticks
archmoj 12ce066
adjust AM/PM period case
archmoj f47c820
adjust hour period case
archmoj c080bc5
adjust period labels depending on break size
archmoj 4c10ddd
adjust period labels for the case of big gaps
archmoj 5775048
split sampling over first and second halves
archmoj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need an
else periodLength = ONEAVGQUARTER
here, to cover the case of quarter tickformat but longerdtick
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the case I thought it could help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I thought we need an else blocks for weeks and quarters to make them similar to others.
But ( as you mentioned) since we don't generate auto labels for weeks and quarters that could lead to the problem of moving daily/monthly labels by a week/quarter. So those else blocks were removed in beed352 commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Adding the else condition would result in wrong label positioning for the case of quarters.
So I think we could resolve this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the case I think this


else
would address: quarter period ticklabels, and dtick of 6 months or 1 year https://codepen.io/alexcjohnson/pen/abNBYxZ?editors=0010Currently this puts the quarter label right on the tick:
but just like when we have monthly labels and 3-month dtick and we shift the label half a month over anyway, we should still be shifting the label half a quarter in this case. If, in this codepen, you change dtick to "M3", exactly a quarter, then it does shift the label correctly:
Note: if you turn rangebreaks back on in that codepen (notice I renamed to rangebreaksx to disable them) and disable the explicit dtick, then all manner of bad things happen as you zoom and pan - unpredictable and nonuniform tick spacing, strange jumps...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. This one fixed by 350a10a.
Here is an updated codepen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I also put
rangebreaks
back in the above pen; and it looks OK.