-
-
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
Implement period ticklabelmode on cartesian date axes #4993
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6de9589
add ticklabelperiod to date axes to move labels to the middle of period
archmoj 4292f08
add mock for period ticklabelmode
archmoj 9f3e1db
use instant key instead of an empty string
archmoj 0e124c2
move tick labels to period positions
archmoj 35a9b91
fix year shift and avoid periods when increment is less than a day
archmoj 93541eb
let explicit tickformat determine the offset not dtick
archmoj 4f271d9
expand checks for various tickformat options
archmoj a5e6aae
hide label when falls outside the range
archmoj 79f6875
fix for reversed ranges
archmoj 08c69d7
label the period before the first tick
archmoj 79385c2
correct the pre tick0 label
archmoj 66a98be
fixups for pre-tick0 and tick0 label in period mode
archmoj 83f5cdd
correct logic for reversed ranges and add tests for some period scena…
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
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
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.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"x": [ | ||
"1900-01-01", | ||
"2000-01-01", | ||
"2100-01-01" | ||
], | ||
"y": [1, 3, 2] | ||
}, | ||
{ | ||
"x": [ | ||
"2013-05-01", | ||
"2013-09-01", | ||
"2014-01-01" | ||
], | ||
"y": [1, 3, 2], | ||
"xaxis": "x2", | ||
"yaxis": "y2" | ||
}, | ||
{ | ||
"x": [ | ||
"2013-11-17", | ||
"2013-12-15", | ||
"2014-01-12" | ||
], | ||
"y": [1, 3, 2], | ||
"xaxis": "x3", | ||
"yaxis": "y3" | ||
}, | ||
{ | ||
"x": [ | ||
"2013-01-01", | ||
"2013-01-02", | ||
"2013-01-03" | ||
], | ||
"y": [1, 3, 2], | ||
"xaxis": "x4", | ||
"yaxis": "y4" | ||
}, | ||
{ | ||
"x": [ | ||
"2013-07-01 18:00", | ||
"2013-07-02 00:00", | ||
"2013-07-02 06:00" | ||
], | ||
"y": [1, 3, 2], | ||
"xaxis": "x5", | ||
"yaxis": "y5" | ||
}, | ||
{ | ||
"x": [ | ||
"2013-01-01 23:59", | ||
"2013-01-02 00:00", | ||
"2013-01-02 00:01" | ||
], | ||
"y": [1, 3, 2], | ||
"xaxis": "x6", | ||
"yaxis": "y6" | ||
}, | ||
{ | ||
"x": [ | ||
"2013-07-01 23:59:59", | ||
"2013-07-02 00:00:00", | ||
"2013-07-02 00:00:01" | ||
], | ||
"y": [1, 3, 2], | ||
"xaxis": "x7", | ||
"yaxis": "y7" | ||
} | ||
], | ||
"layout": { | ||
"showlegend": false, | ||
"width": 600, | ||
"height": 500, | ||
"yaxis": {"domain": [0, 0.04]}, | ||
"yaxis2": {"domain": [0.16, 0.2]}, | ||
"yaxis3": {"domain": [0.32, 0.36]}, | ||
"yaxis4": {"domain": [0.48, 0.52]}, | ||
"yaxis5": {"domain": [0.64, 0.68]}, | ||
"yaxis6": {"domain": [0.80, 0.84]}, | ||
"yaxis7": {"domain": [0.96, 1]}, | ||
"xaxis": {"ticklabelmode": "period"}, | ||
"xaxis2": {"ticklabelmode": "period", "anchor": "y2"}, | ||
"xaxis3": {"ticklabelmode": "period", "anchor": "y3"}, | ||
"xaxis4": {"ticklabelmode": "period", "anchor": "y4"}, | ||
"xaxis5": {"ticklabelmode": "period", "anchor": "y5"}, | ||
"xaxis6": {"ticklabelmode": "period", "anchor": "y6"}, | ||
"xaxis7": {"ticklabelmode": "period", "anchor": "y7"} | ||
} | ||
} |
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.
this is actually not quite the desired behaviour: if the ticks are spaced every 2 months and the labels are
Jan
andMar
, theJan
label should appear on Jan 15, not on Feb 1.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 an example... https://codepen.io/nicolaskruchten/pen/ZEQRBWw?editors=0010
In "instant" mode we see 4 "month" labels spaced two months apart. In "period" mode we probably should see only 3 labels, but they should remain Jan/Mar/May, and they should be positioned on Jan 15, Mar 15, May 15
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.
I'll add a clearer codepen in the original issue