-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix rangebreaks overlapping and tick positions #4831
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c28d0e5
centralize & refactor range expansions
archmoj 1e63bfc
add rangebreaks tests with hourly and auto dticks
archmoj 3baed24
revise tick positioning - fix dtick hourly - move tick0 outside the b…
archmoj 4eab137
drop endpoint ticks that fall inside breaks
archmoj a7633c3
move last tick on rangebreaks to the start of break instead of removi…
archmoj d2d8e6e
revisit ticks on axes with rangebreaks
archmoj ca193eb
reject last tick that may include decimals
archmoj 6b77b31
refactor - no need for else ifs in axes tickIncrement
archmoj ef14d60
add jasmine tests for axes with rangebreaks and set dtick
archmoj a0d4d0d
improve auto ticks on axes with rangebreaks
archmoj 0fb92d4
attempt improving ticks on rangebreaks
archmoj 5c8055b
fix issue 4879
archmoj 0a782d8
invert if statement
archmoj 6cd55b5
drop extra function for hour rangebreaks
archmoj db7d47d
drop extra logic for dayRatio
archmoj 8c8c928
drop extra logic for dynamic oneDay
archmoj 21f4284
drop extra logic for startHour
archmoj 9e7b80e
drop extra logic for dayHours
archmoj 22e5658
avoid too tick overlaps on x axes with rangebreaks and now only when …
archmoj b38688d
reverse loop order
archmoj c5cf45a
fixups to avoid single tick
archmoj 9241578
reduce roughDTick by total length of breaks
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 hidden or 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 hidden or 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,115 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"type": "scatter", | ||
"mode": "markers", | ||
"x": [ | ||
"2020-04-06T09:00:00", | ||
"2020-04-06T10:00:00", | ||
"2020-04-06T11:00:00", | ||
"2020-04-06T12:00:00", | ||
"2020-04-06T13:00:00", | ||
"2020-04-06T14:00:00", | ||
"2020-04-06T15:00:00", | ||
"2020-04-06T16:00:00", | ||
"2020-04-07T09:00:00", | ||
"2020-04-07T10:00:00", | ||
"2020-04-07T11:00:00", | ||
"2020-04-07T12:00:00", | ||
"2020-04-07T13:00:00", | ||
"2020-04-07T14:00:00", | ||
"2020-04-07T15:00:00", | ||
"2020-04-07T16:00:00", | ||
"2020-04-08T09:00:00", | ||
"2020-04-08T10:00:00", | ||
"2020-04-08T11:00:00", | ||
"2020-04-08T12:00:00", | ||
"2020-04-08T13:00:00", | ||
"2020-04-08T14:00:00", | ||
"2020-04-08T15:00:00", | ||
"2020-04-08T16:00:00", | ||
"2020-04-09T09:00:00", | ||
"2020-04-09T10:00:00", | ||
"2020-04-09T11:00:00", | ||
"2020-04-09T12:00:00", | ||
"2020-04-09T13:00:00", | ||
"2020-04-09T14:00:00", | ||
"2020-04-09T15:00:00", | ||
"2020-04-09T16:00:00", | ||
"2020-04-10T09:00:00", | ||
"2020-04-10T10:00:00", | ||
"2020-04-10T11:00:00", | ||
"2020-04-10T12:00:00", | ||
"2020-04-10T13:00:00", | ||
"2020-04-10T14:00:00", | ||
"2020-04-10T15:00:00", | ||
"2020-04-10T16:00:00" | ||
], | ||
"y": [ | ||
0.19742877314456364, | ||
0.1509714558226325, | ||
0.3730270552929804, | ||
0.7394093812216096, | ||
1.2149308862244954, | ||
1.5707342286171064, | ||
1.0824483128021085, | ||
0.9424263772804724, | ||
1.1724169397045303, | ||
0.8440466169659708, | ||
0.8650832231701001, | ||
0.41942121150935374, | ||
0.11941773640575382, | ||
-0.3620604691336322, | ||
-0.06836276577621159, | ||
-0.34443807771583146, | ||
-0.49908639701892876, | ||
-0.07100510355333789, | ||
0.13340929837019488, | ||
-0.33475177209849727, | ||
-0.6700576156005845, | ||
-0.548579214100821, | ||
-0.4713506254966534, | ||
-0.7334578041221448, | ||
-0.299243806197351, | ||
-0.18527785023145504, | ||
-0.14964504720649674, | ||
-0.05973507085192575, | ||
0.17038695866484388, | ||
-0.01766804585555426, | ||
-0.11944698363946238, | ||
-0.40960323466434023, | ||
-0.7234102287840041, | ||
-0.2790378388000705, | ||
-0.039487043750782935, | ||
-0.04902823513321586, | ||
-0.3216136071598926, | ||
-0.5672571253894997, | ||
-1.009227965065624, | ||
-1.0748113395075032 | ||
] | ||
} | ||
], | ||
"layout": { | ||
"width": 800, | ||
"height": 600, | ||
"xaxis": { | ||
"rangebreaks": [ | ||
{ | ||
"bounds": [ | ||
17, | ||
9 | ||
], | ||
"pattern": "hour" | ||
} | ||
], | ||
"title": { | ||
"text": "time" | ||
} | ||
}, | ||
"yaxis": { | ||
"title": { | ||
"text": "values" | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or 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,116 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"type": "scatter", | ||
"mode": "markers", | ||
"x": [ | ||
"2020-04-06T09:00:00", | ||
"2020-04-06T10:00:00", | ||
"2020-04-06T11:00:00", | ||
"2020-04-06T12:00:00", | ||
"2020-04-06T13:00:00", | ||
"2020-04-06T14:00:00", | ||
"2020-04-06T15:00:00", | ||
"2020-04-06T16:00:00", | ||
"2020-04-07T09:00:00", | ||
"2020-04-07T10:00:00", | ||
"2020-04-07T11:00:00", | ||
"2020-04-07T12:00:00", | ||
"2020-04-07T13:00:00", | ||
"2020-04-07T14:00:00", | ||
"2020-04-07T15:00:00", | ||
"2020-04-07T16:00:00", | ||
"2020-04-08T09:00:00", | ||
"2020-04-08T10:00:00", | ||
"2020-04-08T11:00:00", | ||
"2020-04-08T12:00:00", | ||
"2020-04-08T13:00:00", | ||
"2020-04-08T14:00:00", | ||
"2020-04-08T15:00:00", | ||
"2020-04-08T16:00:00", | ||
"2020-04-09T09:00:00", | ||
"2020-04-09T10:00:00", | ||
"2020-04-09T11:00:00", | ||
"2020-04-09T12:00:00", | ||
"2020-04-09T13:00:00", | ||
"2020-04-09T14:00:00", | ||
"2020-04-09T15:00:00", | ||
"2020-04-09T16:00:00", | ||
"2020-04-10T09:00:00", | ||
"2020-04-10T10:00:00", | ||
"2020-04-10T11:00:00", | ||
"2020-04-10T12:00:00", | ||
"2020-04-10T13:00:00", | ||
"2020-04-10T14:00:00", | ||
"2020-04-10T15:00:00", | ||
"2020-04-10T16:00:00" | ||
], | ||
"y": [ | ||
0.19742877314456364, | ||
0.1509714558226325, | ||
0.3730270552929804, | ||
0.7394093812216096, | ||
1.2149308862244954, | ||
1.5707342286171064, | ||
1.0824483128021085, | ||
0.9424263772804724, | ||
1.1724169397045303, | ||
0.8440466169659708, | ||
0.8650832231701001, | ||
0.41942121150935374, | ||
0.11941773640575382, | ||
-0.3620604691336322, | ||
-0.06836276577621159, | ||
-0.34443807771583146, | ||
-0.49908639701892876, | ||
-0.07100510355333789, | ||
0.13340929837019488, | ||
-0.33475177209849727, | ||
-0.6700576156005845, | ||
-0.548579214100821, | ||
-0.4713506254966534, | ||
-0.7334578041221448, | ||
-0.299243806197351, | ||
-0.18527785023145504, | ||
-0.14964504720649674, | ||
-0.05973507085192575, | ||
0.17038695866484388, | ||
-0.01766804585555426, | ||
-0.11944698363946238, | ||
-0.40960323466434023, | ||
-0.7234102287840041, | ||
-0.2790378388000705, | ||
-0.039487043750782935, | ||
-0.04902823513321586, | ||
-0.3216136071598926, | ||
-0.5672571253894997, | ||
-1.009227965065624, | ||
-1.0748113395075032 | ||
] | ||
} | ||
], | ||
"layout": { | ||
"width": 800, | ||
"height": 600, | ||
"xaxis": { | ||
"dtick": 3600000, | ||
"rangebreaks": [ | ||
{ | ||
"bounds": [ | ||
17, | ||
9 | ||
], | ||
"pattern": "hour" | ||
} | ||
], | ||
"title": { | ||
"text": "time" | ||
} | ||
}, | ||
"yaxis": { | ||
"title": { | ||
"text": "values" | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or 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
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 still bothers me - I see it's only in
auto
mode but it seems like this will still have strange effects, especially if you do something unusual with the bounds of the break, like[8.75, 17.25]
. That said I don't understand how we're getting the results we are inaxes_breaks-dtick_auto
of ticks at 9am and noon, ie alternating 3-hour and 5-hour gaps. If we're hitting this block thentick0
gets set to 9am, but then to get a tick at noon we'd need a 3-hour dtick, which would then put another tick at 3pm - not what we see. And I don't think we want a 3/5 alternation as an autotick result anyway, we should regularize that to consistent 4-hour spacing.So a couple of image tests, like you have, are good. But I think we also want to see a bunch of jasmine tests where we just set up an axis and list the ticks (positions and labels) that result within one day. That should let us cover a whole lot more cases: auto-determined dtick from 1 hour to a day and everything between, and a few manually set dtick and tick0 values; each of these tested against each of the hourly rangebreaks I mentioned in #4722 (comment)