11
11
12
12
var Fx = require ( '../../components/fx' ) ;
13
13
var Lib = require ( '../../lib' ) ;
14
+ var Axes = require ( '../../plots/cartesian/axes' ) ;
14
15
15
16
var MAXDIST = Fx . constants . MAXDIST ;
16
17
@@ -26,6 +27,9 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour)
26
27
y = cd0 . y ,
27
28
z = cd0 . z ,
28
29
zmask = cd0 . zmask ,
30
+ range = [ trace . zmin , trace . zmax ] ,
31
+ zhoverformat = trace . zhoverformat ,
32
+ _separators = trace . _separators ,
29
33
x2 = x ,
30
34
y2 = y ,
31
35
xl ,
@@ -99,6 +103,17 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour)
99
103
text = cd0 . text [ ny ] [ nx ] ;
100
104
}
101
105
106
+ var zLabel ;
107
+ // dummy axis for formatting the z value
108
+ var dummyAx = {
109
+ type : 'linear' ,
110
+ range : range ,
111
+ hoverformat : zhoverformat ,
112
+ _separators : _separators
113
+ } ;
114
+ var zLabelObj = Axes . tickText ( dummyAx , zVal , 'hover' ) ;
115
+ zLabel = zLabelObj . text ;
116
+
102
117
return [ Lib . extendFlat ( pointData , {
103
118
index : [ ny , nx ] ,
104
119
// never let a 2D override 1D type as closest point
@@ -110,6 +125,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour)
110
125
xLabelVal : xl ,
111
126
yLabelVal : yl ,
112
127
zLabelVal : zVal ,
128
+ zLabel : zLabel ,
113
129
text : text
114
130
} ) ] ;
115
131
} ;
0 commit comments