-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixup rangebreaks l2p and p2l functions #4699
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 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8df7b6d
correct p2l for rangebreaks
archmoj 4c5d245
ensure min < max and fix hover on reversed ranges
archmoj 4c66949
add failing test - wrong mapping on reversed ranges
archmoj 11c8ea2
fix rangebreaks mapping on reversed ranges - issue 4700
archmoj 063632d
check for Infinity in rangebreak l2p
archmoj 077b34f
make tick loop readable
archmoj 50a2681
optimize fns a bit - pass 1
archmoj 5876608
optimize fns more - pass 2
archmoj 2ed2ec8
fixup test for m2
archmoj 7511cb1
avoid reverse array twice
archmoj ce2e206
apply only one sign
archmoj 18099ae
reduce if block
archmoj 749430d
fix autorange reversed
archmoj ff5db2b
add new hover tests
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
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
Binary file modified
BIN
+1.08 KB
(100%)
test/image/baselines/axes_breaks-night_autorange-reversed.png
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.
237 changes: 237 additions & 0 deletions
237
test/image/mocks/axes_breaks-reversed-without-pattern.json
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,237 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"type": "scatter", | ||
"mode": "markers+lines", | ||
"x": [ | ||
"1970-01-01 00:00:00.000", | ||
"1970-01-01 00:00:00.010", | ||
"1970-01-01 00:00:00.020", | ||
"1970-01-01 00:00:00.030", | ||
"1970-01-01 00:00:00.040", | ||
"1970-01-01 00:00:00.050", | ||
"1970-01-01 00:00:00.060", | ||
"1970-01-01 00:00:00.070", | ||
"1970-01-01 00:00:00.080", | ||
"1970-01-01 00:00:00.090", | ||
"1970-01-01 00:00:00.100", | ||
"1970-01-01 00:00:00.110", | ||
"1970-01-01 00:00:00.120", | ||
"1970-01-01 00:00:00.130", | ||
"1970-01-01 00:00:00.140", | ||
"1970-01-01 00:00:00.150", | ||
"1970-01-01 00:00:00.160", | ||
"1970-01-01 00:00:00.170", | ||
"1970-01-01 00:00:00.180", | ||
"1970-01-01 00:00:00.190", | ||
"1970-01-01 00:00:00.200" | ||
] | ||
}, | ||
{ | ||
"xaxis": "x2", | ||
"yaxis": "y2", | ||
"type": "scatter", | ||
"mode": "markers+lines", | ||
"x": [ | ||
"1970-01-01 00:00:00.000", | ||
"1970-01-01 00:00:00.010", | ||
"1970-01-01 00:00:00.020", | ||
"1970-01-01 00:00:00.030", | ||
"1970-01-01 00:00:00.040", | ||
"1970-01-01 00:00:00.050", | ||
"1970-01-01 00:00:00.060", | ||
"1970-01-01 00:00:00.070", | ||
"1970-01-01 00:00:00.080", | ||
"1970-01-01 00:00:00.090", | ||
"1970-01-01 00:00:00.100", | ||
"1970-01-01 00:00:00.110", | ||
"1970-01-01 00:00:00.120", | ||
"1970-01-01 00:00:00.130", | ||
"1970-01-01 00:00:00.140", | ||
"1970-01-01 00:00:00.150", | ||
"1970-01-01 00:00:00.160", | ||
"1970-01-01 00:00:00.170", | ||
"1970-01-01 00:00:00.180", | ||
"1970-01-01 00:00:00.190", | ||
"1970-01-01 00:00:00.200" | ||
] | ||
}, | ||
{ | ||
"xaxis": "x3", | ||
"yaxis": "y3", | ||
"type": "scatter", | ||
"mode": "markers+lines", | ||
"orientation": "h", | ||
"y": [ | ||
"1970-01-01 00:00:00.000", | ||
"1970-01-01 00:00:00.010", | ||
"1970-01-01 00:00:00.020", | ||
"1970-01-01 00:00:00.030", | ||
"1970-01-01 00:00:00.040", | ||
"1970-01-01 00:00:00.050", | ||
"1970-01-01 00:00:00.060", | ||
"1970-01-01 00:00:00.070", | ||
"1970-01-01 00:00:00.080", | ||
"1970-01-01 00:00:00.090", | ||
"1970-01-01 00:00:00.100", | ||
"1970-01-01 00:00:00.110", | ||
"1970-01-01 00:00:00.120", | ||
"1970-01-01 00:00:00.130", | ||
"1970-01-01 00:00:00.140", | ||
"1970-01-01 00:00:00.150", | ||
"1970-01-01 00:00:00.160", | ||
"1970-01-01 00:00:00.170", | ||
"1970-01-01 00:00:00.180", | ||
"1970-01-01 00:00:00.190", | ||
"1970-01-01 00:00:00.200" | ||
] | ||
}, | ||
{ | ||
"xaxis": "x4", | ||
"yaxis": "y4", | ||
"type": "scatter", | ||
"mode": "markers+lines", | ||
"orientation": "h", | ||
"y": [ | ||
"1970-01-01 00:00:00.000", | ||
"1970-01-01 00:00:00.010", | ||
"1970-01-01 00:00:00.020", | ||
"1970-01-01 00:00:00.030", | ||
"1970-01-01 00:00:00.040", | ||
"1970-01-01 00:00:00.050", | ||
"1970-01-01 00:00:00.060", | ||
"1970-01-01 00:00:00.070", | ||
"1970-01-01 00:00:00.080", | ||
"1970-01-01 00:00:00.090", | ||
"1970-01-01 00:00:00.100", | ||
"1970-01-01 00:00:00.110", | ||
"1970-01-01 00:00:00.120", | ||
"1970-01-01 00:00:00.130", | ||
"1970-01-01 00:00:00.140", | ||
"1970-01-01 00:00:00.150", | ||
"1970-01-01 00:00:00.160", | ||
"1970-01-01 00:00:00.170", | ||
"1970-01-01 00:00:00.180", | ||
"1970-01-01 00:00:00.190", | ||
"1970-01-01 00:00:00.200" | ||
] | ||
} | ||
], | ||
"layout": { | ||
"showlegend": false, | ||
"width": 800, | ||
"height": 800, | ||
"xaxis": { | ||
"rangebreaks": [ | ||
{ | ||
"bounds": [ | ||
"1970-01-01 00:00:00.050", | ||
"1970-01-01 00:00:00.075" | ||
] | ||
}, | ||
{ | ||
"bounds": [ | ||
"1970-01-01 00:00:00.120", | ||
"1970-01-01 00:00:00.180" | ||
] | ||
} | ||
], | ||
"domain": [ | ||
0, | ||
0.48 | ||
] | ||
}, | ||
"xaxis2": { | ||
"rangebreaks": [ | ||
{ | ||
"bounds": [ | ||
"1970-01-01 00:00:00.050", | ||
"1970-01-01 00:00:00.075" | ||
] | ||
}, | ||
{ | ||
"bounds": [ | ||
"1970-01-01 00:00:00.120", | ||
"1970-01-01 00:00:00.180" | ||
] | ||
} | ||
], | ||
"autorange": "reversed", | ||
"anchor": "y2", | ||
"domain": [ | ||
0.52, | ||
1 | ||
] | ||
}, | ||
"xaxis3": { | ||
"anchor": "y3", | ||
"domain": [ | ||
0, | ||
0.48 | ||
] | ||
}, | ||
"xaxis4": { | ||
"anchor": "y4", | ||
"domain": [ | ||
0.52, | ||
1 | ||
] | ||
}, | ||
"yaxis": { | ||
"domain": [ | ||
0, | ||
0.48 | ||
] | ||
}, | ||
"yaxis2": { | ||
"anchor": "x2", | ||
"domain": [ | ||
0.52, | ||
1 | ||
] | ||
}, | ||
"yaxis3": { | ||
"rangebreaks": [ | ||
{ | ||
"bounds": [ | ||
"1970-01-01 00:00:00.050", | ||
"1970-01-01 00:00:00.075" | ||
] | ||
}, | ||
{ | ||
"bounds": [ | ||
"1970-01-01 00:00:00.120", | ||
"1970-01-01 00:00:00.180" | ||
] | ||
} | ||
], | ||
"anchor": "x3", | ||
"domain": [ | ||
0.52, | ||
1 | ||
] | ||
}, | ||
"yaxis4": { | ||
"rangebreaks": [ | ||
{ | ||
"bounds": [ | ||
"1970-01-01 00:00:00.050", | ||
"1970-01-01 00:00:00.075" | ||
] | ||
}, | ||
{ | ||
"bounds": [ | ||
"1970-01-01 00:00:00.120", | ||
"1970-01-01 00:00:00.180" | ||
] | ||
} | ||
], | ||
"autorange": "reversed", | ||
"anchor": "x4", | ||
"domain": [ | ||
0, | ||
0.48 | ||
] | ||
} | ||
} | ||
} |
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.
l2p
is a hot path, so it's worth optimizing a good deal - even if it means some duplicated code, though I'm not sure if that would help here, and even if the code needs more comments and is less self-documenting. For example:signAx * pos
could be done once up front, andvar min = signAx * brk.min
etc would simplify these conditionals a bitfirst
andlast
look unnecessary_m2
for y axes after using it to calculate_B
, so we don't need the(isY ? -1 : 1) *
down below.var isY = axLetter === 'y'
to the outer scope, whereaxLetter
was defined.p2l
I think is generally not as hot, though maybe for some traces it's used in hover? Not sure. (Note thatc2p
usesl2p
andp2c
usesp2l
)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 calls. Addressed in the commits below.