Skip to content

Commit 4aa202a

Browse files
committed
use separate xdata/ydata for picking in scatter plots
1 parent 7cdd644 commit 4aa202a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/traces/scattergl/convert.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ function LineWithMarkers(scene, uid) {
3333
this.scene = scene;
3434
this.uid = uid;
3535

36+
this.pickXData = [];
37+
this.pickYData = [];
3638
this.xData = [];
3739
this.yData = [];
3840
this.textLabels = [];
@@ -113,8 +115,8 @@ proto.handlePick = function(pickResult) {
113115
trace: this,
114116
dataCoord: pickResult.dataCoord,
115117
traceCoord: [
116-
this.xData[index],
117-
this.yData[index]
118+
this.pickXData[index],
119+
this.pickYData[index]
118120
],
119121
textLabel: Array.isArray(this.textLabels) ?
120122
this.textLabels[index] :
@@ -267,8 +269,8 @@ proto.update = function(options) {
267269
};
268270

269271
proto.updateFast = function(options) {
270-
var x = this.xData = options.x;
271-
var y = this.yData = options.y;
272+
var x = this.xData = this.pickXData = options.x;
273+
var y = this.yData = this.pickYData = options.y;
272274

273275
var len = x.length,
274276
idToIndex = new Array(len),
@@ -349,8 +351,8 @@ proto.updateFancy = function(options) {
349351
bounds = this.bounds;
350352

351353
// makeCalcdata runs d2c (data-to-coordinate) on every point
352-
var x = xaxis.makeCalcdata(options, 'x').slice();
353-
var y = yaxis.makeCalcdata(options, 'y').slice();
354+
var x = this.pickXData = xaxis.makeCalcdata(options, 'x').slice();
355+
var y = this.pickYData = yaxis.makeCalcdata(options, 'y').slice();
354356

355357
this.xData = x.slice();
356358
this.yData = y.slice();

0 commit comments

Comments
 (0)