Skip to content

Commit

Permalink
Add support for permutations of direct array support - test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
monfera committed Sep 7, 2016
1 parent 6871cb3 commit 16f7fd5
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/traces/pointcloud/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ proto.handlePick = function(pickResult) {

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

// prefer the readout from XY, if present
return {
trace: this,
dataCoord: pickResult.dataCoord,
traceCoord: [
this.pickXData[index],
this.pickYData[index]
],
traceCoord: this.pickXYData ?
[this.pickXYData[index * 2], this.pickXYData[index * 2 + 1]] :
[this.pickXData[index], this.pickYData[index]],
textLabel: Array.isArray(this.textLabels) ?
this.textLabels[index] :
this.textLabels,
Expand All @@ -81,9 +81,9 @@ proto.update = function(options) {
proto.updateFast = function(options) {
var x = this.xData = this.pickXData = options.x;
var y = this.yData = this.pickYData = options.y;
var xy = this.pickXYData = options.xy;

var xy = options.xy;
var userBounds = options.xbounds && options.ybounds
var userBounds = options.xbounds && options.ybounds;
var index = options.indices;

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

proto.expandAxesFast = function(bounds, markerSizeMin) {
var pad = markerSizeMin || 0.5;
proto.expandAxesFast = function(bounds, markerSize) {
var pad = markerSize || 0.5;
var ax, min, max;

for(var i = 0; i < 2; i++) {
Expand Down
60 changes: 59 additions & 1 deletion test/image/mocks/gl2d_pointcloud-basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,64 @@
"opacity": 0.7,
"x": [3, 4.5, 6],
"y": [9, 9, 9]
},
{
"type": "pointcloud",
"mode": "markers",
"marker": {
"sizemin": 0.5,
"sizemax": 100,
"color": "yellow",
"opacity": 0.8,
"blend": true
},
"opacity": 0.7,
"xy": new Float32Array([1, 3, 9, 3]),
"indices": new Int32Array([0, 1]),
"xbounds": [1, 9],
"ybounds": [3, 3]
},
{
"type": "pointcloud",
"mode": "markers",
"marker": {
"sizemin": 0.5,
"sizemax": 100,
"color": "orange",
"opacity": 0.8,
"blend": true
},
"opacity": 0.7,
"xy": new Float32Array([1, 4, 9, 4]),
"indices": new Int32Array([0, 1])
},
{
"type": "pointcloud",
"mode": "markers",
"marker": {
"sizemin": 0.5,
"sizemax": 100,
"color": "darkorange",
"opacity": 0.8,
"blend": true
},
"opacity": 0.7,
"xy": new Float32Array([1, 5, 9, 5]),
"xbounds": [1, 9],
"ybounds": [5, 5]
},
{
"type": "pointcloud",
"mode": "markers",
"marker": {
"sizemin": 0.5,
"sizemax": 100,
"color": "red",
"opacity": 0.8,
"blend": true
},
"opacity": 0.7,
"xy": new Float32Array([1, 6, 9, 6])
}
],
"layout": {
Expand All @@ -69,4 +127,4 @@
"autosize": true,
"showlegend": false
}
}
}

0 comments on commit 16f7fd5

Please sign in to comment.