Skip to content

Commit b1da4c0

Browse files
committed
Add support for permutations of direct array support - test cases
1 parent 5838ca9 commit b1da4c0

File tree

2 files changed

+67
-9
lines changed

2 files changed

+67
-9
lines changed

src/traces/pointcloud/convert.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ proto.handlePick = function(pickResult) {
5050

5151
var index = this.idToIndex[pickResult.pointId];
5252

53+
// prefer the readout from XY, if present
5354
return {
5455
trace: this,
5556
dataCoord: pickResult.dataCoord,
56-
traceCoord: [
57-
this.pickXData[index],
58-
this.pickYData[index]
59-
],
57+
traceCoord: this.pickXYData ?
58+
[this.pickXYData[index * 2], this.pickXYData[index * 2 + 1]] :
59+
[this.pickXData[index], this.pickYData[index]],
6060
textLabel: Array.isArray(this.textLabels) ?
6161
this.textLabels[index] :
6262
this.textLabels,
@@ -81,9 +81,9 @@ proto.update = function(options) {
8181
proto.updateFast = function(options) {
8282
var x = this.xData = this.pickXData = options.x;
8383
var y = this.yData = this.pickYData = options.y;
84+
var xy = this.pickXYData = options.xy;
8485

85-
var xy = options.xy;
86-
var userBounds = options.xbounds && options.ybounds
86+
var userBounds = options.xbounds && options.ybounds;
8787
var index = options.indices;
8888

8989
var len,
@@ -188,8 +188,8 @@ proto.updateFast = function(options) {
188188
this.expandAxesFast(bounds, markerSizeMax / 2); // avoid axis reexpand just because of the adaptive point size
189189
};
190190

191-
proto.expandAxesFast = function(bounds, markerSizeMin) {
192-
var pad = markerSizeMin || 0.5;
191+
proto.expandAxesFast = function(bounds, markerSize) {
192+
var pad = markerSize || 0.5;
193193
var ax, min, max;
194194

195195
for(var i = 0; i < 2; i++) {

test/image/mocks/gl2d_pointcloud-basic.json

+59-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,64 @@
4444
"opacity": 0.7,
4545
"x": [3, 4.5, 6],
4646
"y": [9, 9, 9]
47+
},
48+
{
49+
"type": "pointcloud",
50+
"mode": "markers",
51+
"marker": {
52+
"sizemin": 0.5,
53+
"sizemax": 100,
54+
"color": "yellow",
55+
"opacity": 0.8,
56+
"blend": true
57+
},
58+
"opacity": 0.7,
59+
"xy": new Float32Array([1, 3, 9, 3]),
60+
"indices": new Int32Array([0, 1]),
61+
"xbounds": [1, 9],
62+
"ybounds": [3, 3]
63+
},
64+
{
65+
"type": "pointcloud",
66+
"mode": "markers",
67+
"marker": {
68+
"sizemin": 0.5,
69+
"sizemax": 100,
70+
"color": "orange",
71+
"opacity": 0.8,
72+
"blend": true
73+
},
74+
"opacity": 0.7,
75+
"xy": new Float32Array([1, 4, 9, 4]),
76+
"indices": new Int32Array([0, 1])
77+
},
78+
{
79+
"type": "pointcloud",
80+
"mode": "markers",
81+
"marker": {
82+
"sizemin": 0.5,
83+
"sizemax": 100,
84+
"color": "darkorange",
85+
"opacity": 0.8,
86+
"blend": true
87+
},
88+
"opacity": 0.7,
89+
"xy": new Float32Array([1, 5, 9, 5]),
90+
"xbounds": [1, 9],
91+
"ybounds": [5, 5]
92+
},
93+
{
94+
"type": "pointcloud",
95+
"mode": "markers",
96+
"marker": {
97+
"sizemin": 0.5,
98+
"sizemax": 100,
99+
"color": "red",
100+
"opacity": 0.8,
101+
"blend": true
102+
},
103+
"opacity": 0.7,
104+
"xy": new Float32Array([1, 6, 9, 6])
47105
}
48106
],
49107
"layout": {
@@ -69,4 +127,4 @@
69127
"autosize": true,
70128
"showlegend": false
71129
}
72-
}
130+
}

0 commit comments

Comments
 (0)