Skip to content

Commit 63ee7f7

Browse files
committed
fx: add eventData hook to customize event data module-by-module
1 parent 3d0aeff commit 63ee7f7

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/plots/cartesian/graph_interact.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -583,19 +583,27 @@ function hover(gd, evt, subplot) {
583583
// other people and send it to the event
584584
for(itemnum = 0; itemnum < hoverData.length; itemnum++) {
585585
var pt = hoverData[itemnum];
586+
586587
var out = {
587588
data: pt.trace._input,
588589
fullData: pt.trace,
589590
curveNumber: pt.trace.index,
590-
pointNumber: pt.index,
591-
x: pt.xVal,
592-
y: pt.yVal,
593-
xaxis: pt.xa,
594-
yaxis: pt.ya
591+
pointNumber: pt.index
595592
};
596-
if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal;
593+
594+
if(pt.trace._module.eventData) out = pt.trace._module.eventData(out, pt);
595+
else {
596+
out.x = pt.xVal;
597+
out.y = pt.yVal;
598+
out.xaxis = pt.xa;
599+
out.yaxis = pt.ya;
600+
601+
if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal;
602+
}
603+
597604
newhoverdata.push(out);
598605
}
606+
599607
gd._hoverdata = newhoverdata;
600608

601609
if(!hoverChanged(gd, evt, oldhoverdata)) return;

0 commit comments

Comments
 (0)