Skip to content

Commit 638d03d

Browse files
committed
adapt Histogram.eventData so that it works with selection pts
1 parent 54cc67b commit 638d03d

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/traces/histogram/event_data.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,23 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
109
'use strict';
1110

12-
13-
module.exports = function eventData(out, pt) {
11+
module.exports = function eventData(out, pt, trace, cd, pointNumber) {
1412
// standard cartesian event data
15-
out.x = pt.xVal;
16-
out.y = pt.yVal;
17-
out.xaxis = pt.xa;
18-
out.yaxis = pt.ya;
13+
out.x = 'xVal' in pt ? pt.xVal : pt.x;
14+
out.y = 'yVal' in pt ? pt.yVal : pt.y;
15+
16+
if(pt.xa) out.xaxis = pt.xa;
17+
if(pt.ya) out.yaxis = pt.ya;
18+
19+
// specific to histogram - CDFs do not have pts (yet?)
20+
if(!(trace.cumulative || {}).enabled) {
21+
var pts = Array.isArray(pointNumber) ?
22+
cd[0].pts[pointNumber[0]][pointNumber[1]] :
23+
cd[pointNumber].pts;
1924

20-
// specific to histogram
21-
// CDFs do not have pts (yet?)
22-
if(pt.pts) {
23-
out.pointNumbers = pt.pts;
25+
out.pointNumbers = pts;
2426
out.binNumber = out.pointNumber;
2527
delete out.pointNumber;
2628
}

src/traces/histogram/hover.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
2525
var posLetter = trace.orientation === 'h' ? 'y' : 'x';
2626

2727
pointData[posLetter + 'Label'] = hoverLabelText(pointData[posLetter + 'a'], di.p0, di.p1);
28-
pointData.pts = di.pts;
2928
}
3029

3130
return pts;

src/traces/histogram2d/hover.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay
2727

2828
pointData.xLabel = hoverLabelText(pointData.xa, xRange[0], xRange[1]);
2929
pointData.yLabel = hoverLabelText(pointData.ya, yRange[0], yRange[1]);
30-
pointData.pts = cd0.pts[ny][nx];
3130

3231
return pts;
3332
};

0 commit comments

Comments
 (0)