-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Output bounding box to hover event data #5512
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
Changes from 1 commit
4573f34
e817828
86a4fbe
4b04337
034779d
9a57ec3
6078118
03b22ec
17dbadd
bd6688e
ccd2c88
c41b31d
888a6ba
8100f8a
262505d
53e1b61
aa00c18
9716d7e
6ba88db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,11 @@ module.exports = function eventData(out, pt, trace) { | |
| if(pt.xa) out.xaxis = pt.xa; | ||
| if(pt.ya) out.yaxis = pt.ya; | ||
|
|
||
| if ('x0' in pt) out.x0 = pt.x0; | ||
| if ('x1' in pt) out.x1 = pt.x1; | ||
| if ('y0' in pt) out.y0 = pt.y0; | ||
| if ('y1' in pt) out.y1 = pt.y1; | ||
|
|
||
|
||
| if(trace.orientation === 'h') { | ||
| out.label = out.y; | ||
| out.value = out.x; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,16 @@ module.exports = function eventData(pt, trace) { | |
| text: pt.text, | ||
|
|
||
| // pt.v (and pt.i below) for backward compatibility | ||
| v: pt.v | ||
| v: pt.v, | ||
|
|
||
| // TODO: These coordinates aren't quite correct and don't take into account some offset | ||
| // I still haven't quite located (similar to xa._offset) | ||
|
||
| bbox: { | ||
| x0: pt.x0, | ||
| x1: pt.x1, | ||
| y0: pt.y0, | ||
| y1: pt.y1, | ||
| }, | ||
| }; | ||
|
|
||
| // Only include pointNumber if it's unambiguous | ||
|
|
||
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.
🌴 there's 7 or 8 of these... could be something like
copyCoords(pt, out)- could even include thexa/ya->xaxis/yaxispart, AFAICT onlyscattercarpetis missing that one, but I bet it wouldn't even hurt to include that.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.
Is that information already accessible through
plotly_hover? If so, can't we just modifydcc.Graphinstead of making this PR?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.
The original mouse event is accessible in
plotly_hover, and that contains the pointer location in various coordinate systems. But plotly.js hover events are more sophisticated, and it would be far better if we can match the plotly.js behavior with our new interface.