-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathhover.js
27 lines (21 loc) · 878 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
'use strict';
var Color = require('../../components/color');
var heatmapHoverPoints = require('../heatmap/hover');
module.exports = function hoverPoints(pointData, xval, yval, hovermode, opts) {
if(!opts) opts = {};
opts.isContour = true;
var hoverData = heatmapHoverPoints(pointData, xval, yval, hovermode, opts);
if(hoverData) {
hoverData.forEach(function(hoverPt) {
var trace = hoverPt.trace;
if(trace.contours.type === 'constraint') {
if(trace.fillcolor && Color.opacity(trace.fillcolor)) {
hoverPt.color = Color.addOpacity(trace.fillcolor, 1);
} else if(trace.contours.showlines && Color.opacity(trace.line.color)) {
hoverPt.color = Color.addOpacity(trace.line.color, 1);
}
}
});
}
return hoverData;
};