Uh oh!
There was an error while loading. Please reload this page.
Fixup rangebreaks l2p and p2l functions - #4699
Conversation
alexcjohnson
commented
Mar 29, 2020
What's going on with autorange in axes_breaks-night_autorange-reversed.png ? Both the orange and red subplots prior to this PR have tight clipping on one side, and after this PR the tight clipping is on the other side. Neither side should have tight clipping, they should both get 5% padding. Also what's with the label |
| else { | ||
| // when falls into break, pick 'closest' offset | ||
| q = pos > (min + max) / 2 ? nextI : i; | ||
| q = signAx * pos > signAx * (min + max) / 2 ? nextI : i; |
There was a problem hiding this comment.
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 * poscould be done once up front, andvar min = signAx * brk.minetc would simplify these conditionals a bitfirstandlastlook unnecessary- Flip
_m2for y axes after using it to calculate_B, so we don't need the(isY ? -1 : 1) *down below. - Move
var isY = axLetter === 'y'to the outer scope, whereaxLetterwas defined.
p2l I think is generally not as hot, though maybe for some traces it's used in hover? Not sure. (Note that c2p uses l2p and p2c uses p2l)
There was a problem hiding this comment.
Good calls. Addressed in the commits below.
archmoj
commented
Mar 29, 2020
Fixed by 749430d. |

Following of #4614,
this PR fixes
l2p&p2lfunctionscorrect reversed ranges fixesrangebreaks mapping on reversed ranges #4700
see 11c8ea2?short_path=563a470#diff-563a470dab197f9857d9545f11805d89
find correct hover indices and fixesrangebreaks hovermode=closest offset #4693
Hover demo: before vs after
Hover demo2: bar + reversed range
@plotly/plotly_js