-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Adding pointcloud #850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding pointcloud #850
Changes from all commits
3dd18ea
7b6edbc
95925a3
5f4847d
bfd0af8
6871cb3
16f7fd5
a69af31
5d37b54
8a09ccd
8105955
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Copyright 2012-2016, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
module.exports = require('../src/traces/pointcloud'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Copyright 2012-2016, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/** | ||
* Truncate a Float32Array to some length. A wrapper to support environments | ||
* (e.g. node-webkit) that do not implement Float32Array.prototype.slice | ||
*/ | ||
module.exports = function truncate(float32ArrayIn, len) { | ||
// for some reason, ES2015 Float32Array.prototype.slice takes 2x as long... | ||
// therefore we aren't checking for its existence | ||
var float32ArrayOut = new Float32Array(len); | ||
for(var i = 0; i < len; i++) float32ArrayOut[i] = float32ArrayIn[i]; | ||
return float32ArrayOut; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/** | ||
* Copyright 2012-2016, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var scatterglAttrs = require('../scattergl/attributes'); | ||
|
||
module.exports = { | ||
x: scatterglAttrs.x, | ||
y: scatterglAttrs.y, | ||
xy: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a dream come true |
||
valType: 'data_array', | ||
description: [ | ||
'Faster alternative to specifying `x` and `y` separately.', | ||
'If supplied, it must be a typed `Float32Array` array that', | ||
'represents points such that `xy[i * 2] = x[i]` and `xy[i * 2 + 1] = y[i]`' | ||
].join(' ') | ||
}, | ||
indices: { | ||
valType: 'data_array', | ||
description: [ | ||
'A sequential value, 0..n, supply it to avoid creating this array inside plotting.', | ||
'If specified, it must be a typed `Int32Array` array.', | ||
'Its length must be equal to or greater than the number of points.', | ||
'For the best performance and memory use, create one large `indices` typed array', | ||
'that is guaranteed to be at least as long as the largest number of points during', | ||
'use, and reuse it on each `Plotly.restyle()` call.' | ||
].join(' ') | ||
}, | ||
xbounds: { | ||
valType: 'data_array', | ||
description: [ | ||
'Specify `xbounds` in the shape of `[xMin, xMax] to avoid looping through', | ||
'the `xy` typed array. Use it in conjunction with `xy` and `ybounds` for the performance benefits.' | ||
].join(' ') | ||
}, | ||
ybounds: { | ||
valType: 'data_array', | ||
description: [ | ||
'Specify `ybounds` in the shape of `[yMin, yMax] to avoid looping through', | ||
'the `xy` typed array. Use it in conjunction with `xy` and `xbounds` for the performance benefits.' | ||
].join(' ') | ||
}, | ||
text: scatterglAttrs.text, | ||
marker: { | ||
color: { | ||
valType: 'color', | ||
arrayOk: false, | ||
role: 'style', | ||
description: [ | ||
'Sets the marker fill color. It accepts a specific color.', | ||
'If the color is not fully opaque and there are hundreds of thousands', | ||
'of points, it may cause slower zooming and panning.' | ||
].join('') | ||
}, | ||
opacity: { | ||
valType: 'number', | ||
min: 0, | ||
max: 1, | ||
dflt: 1, | ||
arrayOk: false, | ||
role: 'style', | ||
description: [ | ||
'Sets the marker opacity. The default value is `1` (fully opaque).', | ||
'If the markers are not fully opaque and there are hundreds of thousands', | ||
'of points, it may cause slower zooming and panning.', | ||
'Opacity fades the color even if `blend` is left on `false` even if there', | ||
'is no translucency effect in that case.' | ||
].join(' ') | ||
}, | ||
blend: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice 🎉 |
||
valType: 'boolean', | ||
dflt: false, | ||
role: 'style', | ||
description: [ | ||
'Determines if colors are blended together for a translucency effect', | ||
'in case `opacity` is specified as a value less then `1`.', | ||
'Setting `blend` to `true` reduces zoom/pan', | ||
'speed if used with large numbers of points.' | ||
].join(' ') | ||
}, | ||
sizemin: { | ||
valType: 'number', | ||
min: 0.1, | ||
max: 2, | ||
dflt: 0.5, | ||
role: 'style', | ||
description: [ | ||
'Sets the minimum size (in px) of the rendered marker points, effective when', | ||
'the `pointcloud` shows a million or more points.' | ||
].join(' ') | ||
}, | ||
sizemax: { | ||
valType: 'number', | ||
min: 0.1, | ||
dflt: 20, | ||
role: 'style', | ||
description: [ | ||
'Sets the maximum size (in px) of the rendered marker points.', | ||
'Effective when the `pointcloud` shows only few points.' | ||
].join(' ') | ||
}, | ||
border: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, |
||
color: { | ||
valType: 'color', | ||
arrayOk: false, | ||
role: 'style', | ||
description: [ | ||
'Sets the stroke color. It accepts a specific color.', | ||
'If the color is not fully opaque and there are hundreds of thousands', | ||
'of points, it may cause slower zooming and panning.' | ||
].join(' ') | ||
}, | ||
arearatio: { | ||
valType: 'number', | ||
min: 0, | ||
max: 1, | ||
dflt: 0, | ||
role: 'style', | ||
description: [ | ||
'Specifies what fraction of the marker area is covered with the', | ||
'border.' | ||
].join(' ') | ||
} | ||
} | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very interesting comment. Thanks for checking!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All too often, 'recently' added language elements (as in: the last few years) are slower even if intuitively they should be faster. Back in 2014, untyped arrays were faster than typed arrays even for plain calculations; same with
Map
.