More zoomed-in box/violin hover labels fixes #3965
Conversation
... to not confuse 'xa' & 'ya' with ax objects
- N.B. in the case where multiple item in a given d3-data bound array have identical key-function results, *only the first* of those items is considered. This implies that the `i` in e.g `selection.each(function(d, i) { })` does not always increment with a constant step.
... so that if the min and q1 overlap and have the same overlap key-function output, q1 will be rendered, not min
- this makes all box/hover labels render even when their x/y positions overlap perfectly.
Thank you for fixing #3962 @etpinard ! As far as I'm concerned, this PR deserves a dancer as it improves things. However, I'll let @nicolaskruchten and/or @alexcjohnson comment on the decision of showing all boxes (ie. ce5e5f9). |
Yep, much better! Does look a little weird to have the arrows pointing right at the edge of the plot area, but of course this is what we do in other contexts where you're hovering on something off-plot. So maybe at some point we can alter that somehow to make it clearer they're not actually right there. Maybe as simple as getting rid of the arrow altogether, so these ones only have the box? |
Follow-up in #3985 |
Ok, let's start merging things for |
@plotly/plotly_js This presents a few commits that alters (mostly fixes😏 ) the box/violin hover behaviour when their corresponding value axis range is within the box/violin q1/q3 values. This PR is essentially generalises #3889
Consider,
Currently on master (ever since #3645, released in
v1.45.3
), hovering over the box gets us an exception on this lineplotly.js/src/components/fx/hover.js
Line 1187 in 0690162
as reported in #3962
Commit a4b771c is enough to fix the problem and matches the pre-
1.45.3
behaviour:but notice that
min
andq3
are shown andq1
andmax
are not, which looked odd to me.Commit 1634ec8 made
q1
andq3
show instead:which I think is better as we show both "innermost" values, but maybe we could do even better.
Commit ce5e5f9 made all box labels show i.e.
min
,q1
,median
,q3
andmax
while avoiding overlaps on the y-axis bounds:which I feel matches similar scenarios (e.g zoomed-in stack bars codepen) better, but please let me know if you disagree.