Skip to content

Commit 2235991

Browse files
committed
Pointcloud - plotly,js bindings (squashed)
1 parent 0daa5d6 commit 2235991

File tree

11 files changed

+446
-14
lines changed

11 files changed

+446
-14
lines changed

lib/index-gl2d.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var Plotly = require('./core');
1212

1313
Plotly.register([
1414
require('./scattergl'),
15+
require('./pointcloud'),
1516
require('./heatmapgl'),
1617
require('./contourgl')
1718
]);

lib/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Plotly.register([
2525
require('./scattergeo'),
2626
require('./choropleth'),
2727
require('./scattergl'),
28+
require('./pointcloud'),
2829
require('./scatterternary'),
2930
require('./scattermapbox')
3031
]);

lib/pointcloud.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Copyright 2012-2016, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
module.exports = require('../src/traces/pointcloud');

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"gl-plot3d": "^1.5.0",
6969
"gl-scatter2d": "^1.0.5",
7070
"gl-scatter2d-fancy": "^1.1.1",
71+
"gl-pointcloud2d": "gl-vis/gl-pointcloud2d",
7172
"gl-scatter3d": "^1.0.4",
7273
"gl-select-box": "^1.0.1",
7374
"gl-spikes2d": "^1.0.1",

src/.eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"Promise": true,
88
"Float32Array": true,
99
"Uint8Array": true,
10+
"Int32Array": true,
1011
"ArrayBuffer": true
1112
},
1213
"rules": {

src/lib/float32_truncate.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Copyright 2012-2016, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
/**
12+
* Truncate a Float32Array to some length. A wrapper to support environments
13+
* (e.g. node-webkit) that do not implement Float32Array.prototype.slice
14+
*/
15+
module.exports = function truncate(float32ArrayIn, len) {
16+
// for some reason, ES2015 Float32Array.prototype.slice takes 2x as long...
17+
// therefore we aren't checking for its existence
18+
var float32ArrayOut = new Float32Array(len);
19+
for(var i = 0; i < len; i++) float32ArrayOut[i] = float32ArrayIn[i];
20+
return float32ArrayOut;
21+
};

src/traces/pointcloud/attributes.js

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/**
2+
* Copyright 2012-2016, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
var scatterglAttrs = require('../scattergl/attributes');
12+
13+
module.exports = {
14+
x: scatterglAttrs.x,
15+
y: scatterglAttrs.y,
16+
xy: {
17+
valType: 'data_array',
18+
description: [
19+
'Faster alternative to specifying `x` and `y` separately.',
20+
'If supplied, it must be a typed `Float32Array` array that',
21+
'represents points such that `xy[i * 2] = x[i]` and `xy[i * 2 + 1] = y[i]`'
22+
].join(' ')
23+
},
24+
indexid: {
25+
valType: 'data_array',
26+
description: [
27+
'A sequential value, 0..n, supply it to avoid creating this array inside plotting.',
28+
'Its length must be equal to or greater than the number of points.',
29+
'For the best performance and memory use, create one large `indexid` typed array',
30+
'that is guaranteed to be at least as long as the largest number of points during',
31+
'use, and reuse it on each `Plotly.restyle()` call.'
32+
].join(' ')
33+
},
34+
bounds: {
35+
valType: 'data_array',
36+
description: [
37+
'Specify `bounds` in the shape of `[xMin, yMin, xMax, yMax] to avoid looping through',
38+
'the `xy` typed array.'
39+
].join(' ')
40+
},
41+
text: scatterglAttrs.text,
42+
marker: {
43+
color: {
44+
valType: 'color',
45+
arrayOk: false,
46+
role: 'style',
47+
description: [
48+
'Sets the marker fill color. It accepts a specific color.',
49+
'If the color is not fully opaque and there are hundreds of thousands',
50+
'of points, it may cause slower zooming and panning.'
51+
].join('')
52+
},
53+
opacity: {
54+
valType: 'number',
55+
min: 0,
56+
max: 1,
57+
dflt: 1,
58+
arrayOk: false,
59+
role: 'style',
60+
description: [
61+
'Sets the marker opacity. The default value is `1` (fully opaque).',
62+
'If the markers are not fully opaque and there are hundreds of thousands',
63+
'of points, it may cause slower zooming and panning.',
64+
'Opacity fades the color even if `blend` is left on `false` even if there',
65+
'is no translucency effect in that case.'
66+
].join(' ')
67+
},
68+
blend: {
69+
valType: 'boolean',
70+
dflt: false,
71+
role: 'style',
72+
description: [
73+
'Determines if colors are blended together for a translucency effect',
74+
'in case `opacity` is specified as a value less then `1`.',
75+
'Setting `blend` to `true` reduces zoom/pan',
76+
'speed if used with large numbers of points.'
77+
].join(' ')
78+
},
79+
sizemin: {
80+
valType: 'number',
81+
min: 0.1,
82+
max: 2,
83+
dflt: 0.5,
84+
role: 'style',
85+
description: [
86+
'Sets the minimum size (in px) of the rendered marker points, effective when',
87+
'the `pointcloud` shows a million or more points.'
88+
].join(' ')
89+
},
90+
sizemax: {
91+
valType: 'number',
92+
min: 0.1,
93+
dflt: 20,
94+
role: 'style',
95+
description: [
96+
'Sets the maximum size (in px) of the rendered marker points.',
97+
'Effective when the `pointcloud` shows only few points.'
98+
].join(' ')
99+
},
100+
border: {
101+
color: {
102+
valType: 'color',
103+
arrayOk: false,
104+
role: 'style',
105+
description: [
106+
'Sets the stroke color. It accepts a specific color.',
107+
'If the color is not fully opaque and there are hundreds of thousands',
108+
'of points, it may cause slower zooming and panning.'
109+
].join(' ')
110+
},
111+
arearatio: {
112+
valType: 'number',
113+
min: 0,
114+
max: 1,
115+
dflt: 0,
116+
role: 'style',
117+
description: [
118+
'Specifies what fraction of the marker area is covered with the',
119+
'border.'
120+
].join(' ')
121+
}
122+
}
123+
}
124+
};

0 commit comments

Comments
 (0)