-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathhover.js
28 lines (21 loc) · 838 Bytes
/
hover.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'use strict';
var Axes = require('../../plots/cartesian/axes');
var scatterMapboxHoverPoints = require('../scattermapbox/hover').hoverPoints;
var getExtraText = require('../scattermapbox/hover').getExtraText;
module.exports = function hoverPoints(pointData, xval, yval) {
var pts = scatterMapboxHoverPoints(pointData, xval, yval);
if(!pts) return;
var newPointData = pts[0];
var cd = newPointData.cd;
var trace = cd[0].trace;
var di = cd[newPointData.index];
// let Fx.hover pick the color
delete newPointData.color;
if('z' in di) {
var ax = newPointData.subplot.mockAxis;
newPointData.z = di.z;
newPointData.zLabel = Axes.tickText(ax, ax.c2l(di.z), 'hover').text;
}
newPointData.extraText = getExtraText(trace, di, cd[0].t.labels);
return [newPointData];
};