Skip to content

Commit f059957

Browse files
committed
format hover labels before filtering them
1 parent 75f243c commit f059957

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/plots/gl3d/scene.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,28 @@ function render(scene) {
6868

6969
if(lastPicked !== null) {
7070
var pdata = project(scene.glplot.cameraParams, selection.dataCoordinate),
71-
hoverinfo = lastPicked.data.hoverinfo;
71+
trace = lastPicked.data,
72+
hoverinfo = trace.hoverinfo;
73+
74+
var xVal = formatter('xaxis', selection.traceCoordinate[0]),
75+
yVal = formatter('yaxis', selection.traceCoordinate[1]),
76+
zVal = formatter('zaxis', selection.traceCoordinate[2]);
7277

7378
if(hoverinfo !== 'all') {
7479
var hoverinfoParts = hoverinfo.split('+');
75-
if(hoverinfoParts.indexOf('x') === -1) selection.traceCoordinate[0] = undefined;
76-
if(hoverinfoParts.indexOf('y') === -1) selection.traceCoordinate[1] = undefined;
77-
if(hoverinfoParts.indexOf('z') === -1) selection.traceCoordinate[2] = undefined;
80+
if(hoverinfoParts.indexOf('x') === -1) xVal = undefined;
81+
if(hoverinfoParts.indexOf('y') === -1) yVal = undefined;
82+
if(hoverinfoParts.indexOf('z') === -1) zVal = undefined;
7883
if(hoverinfoParts.indexOf('text') === -1) selection.textLabel = undefined;
7984
if(hoverinfoParts.indexOf('name') === -1) lastPicked.name = undefined;
8085
}
8186

8287
Fx.loneHover({
83-
x: (0.5 + 0.5 * pdata[0]/pdata[3]) * width,
84-
y: (0.5 - 0.5 * pdata[1]/pdata[3]) * height,
85-
xLabel: formatter('xaxis', selection.traceCoordinate[0]),
86-
yLabel: formatter('yaxis', selection.traceCoordinate[1]),
87-
zLabel: formatter('zaxis', selection.traceCoordinate[2]),
88+
x: (0.5 + 0.5 * pdata[0] / pdata[3]) * width,
89+
y: (0.5 - 0.5 * pdata[1] / pdata[3]) * height,
90+
xLabel: xVal,
91+
yLabel: yVal,
92+
zLabel: zVal,
8893
text: selection.textLabel,
8994
name: lastPicked.name,
9095
color: lastPicked.color

0 commit comments

Comments
 (0)