Skip to content

Commit cb5698a

Browse files
committed
add opts arg to hoverPoints
1 parent d0e1bef commit cb5698a

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/traces/contour/hover.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var Color = require('../../components/color');
55
var heatmapHoverPoints = require('../heatmap/hover');
66

77
module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLayer) {
8-
var hoverData = heatmapHoverPoints(pointData, xval, yval, hovermode, hoverLayer, true);
8+
var hoverData = heatmapHoverPoints(pointData, xval, yval, hovermode, hoverLayer, {isContour: true});
99

1010
if(hoverData) {
1111
hoverData.forEach(function(hoverPt) {

src/traces/heatmap/hover.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ var Lib = require('../../lib');
55
var Axes = require('../../plots/cartesian/axes');
66
var extractOpts = require('../../components/colorscale').extractOpts;
77

8-
module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLayer, contour) {
8+
module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLayer, opts) {
9+
if(!opts) opts = {};
10+
var isContour = opts.isContour;
11+
912
var cd0 = pointData.cd[0];
1013
var trace = cd0.trace;
1114
var xa = pointData.xa;
@@ -38,7 +41,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay
3841
Fx.inbox(yval - y[0], yval - y[y.length - 1], 0) > 0) {
3942
return;
4043
} else {
41-
if(contour) {
44+
if(isContour) {
4245
var i2;
4346
x2 = [2 * x[0] - x[1]];
4447

@@ -63,7 +66,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay
6366
var y1 = ya.c2p(y[ny + 1]);
6467

6568
var _x, _y;
66-
if(contour) {
69+
if(isContour) {
6770
_x = cd0.orig_x || x;
6871
_y = cd0.orig_y || y;
6972

src/traces/histogram2d/hover.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
var heatmapHover = require('../heatmap/hover');
44
var hoverLabelText = require('../../plots/cartesian/axes').hoverLabelText;
55

6-
module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLayer, contour) {
7-
var pts = heatmapHover(pointData, xval, yval, hovermode, hoverLayer, contour);
6+
module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLayer, opts) {
7+
var pts = heatmapHover(pointData, xval, yval, hovermode, hoverLayer, opts);
88

99
if(!pts) return;
1010

0 commit comments

Comments
 (0)