Skip to content

Commit 954c291

Browse files
committed
new attributes and doc strings
1 parent b45d3d7 commit 954c291

File tree

3 files changed

+80
-11
lines changed

3 files changed

+80
-11
lines changed

src/traces/pointcloud/attributes.js

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,73 @@ module.exports = {
1818
y0: scatterglAttrs.y0,
1919
dy: scatterglAttrs.dy,
2020
text: scatterglAttrs.text,
21-
marker: scatterglAttrs.marker
21+
marker: {
22+
color: {
23+
valType: 'color',
24+
arrayOk: false,
25+
role: 'style',
26+
description: [
27+
'Sets the marker fill color. It accepts a specific color.',
28+
'If the color is not fully opaque and there are hundreds of thousands',
29+
'of points, it may cause slower zooming and panning.'
30+
].join('')
31+
},
32+
opacity: {
33+
valType: 'number',
34+
min: 0,
35+
max: 1,
36+
dflt: 1,
37+
arrayOk: false,
38+
role: 'style',
39+
description: [
40+
'Sets the marker opacity. The default value is `1` (fully opaque).',
41+
'If the markers are not fully opaque and there are hundreds of thousands',
42+
'of points, it may cause slower zooming and panning.'
43+
].join(' ')
44+
},
45+
sizemin: {
46+
valType: 'number',
47+
min: 0.1,
48+
max: 2,
49+
dflt: 0.5,
50+
role: 'style',
51+
description: [
52+
'Sets the minimum size (in px) of the rendered marker points, effective when',
53+
'the `pointcloud` shows a million or more points.'
54+
].join(' ')
55+
},
56+
sizemax: {
57+
valType: 'number',
58+
min: 0.1,
59+
dflt: 0.5,
60+
role: 'style',
61+
description: [
62+
'Sets the maximum size (in px) of the rendered marker points.',
63+
'Effective when the `pointcloud` shows only few points.'
64+
].join(' ')
65+
},
66+
border: {
67+
color: {
68+
valType: 'color',
69+
arrayOk: false,
70+
role: 'style',
71+
description: [
72+
'Sets the stroke color. It accepts a specific color.',
73+
'If the color is not fully opaque and there are hundreds of thousands',
74+
'of points, it may cause slower zooming and panning.'
75+
].join(' ')
76+
},
77+
arearatio: {
78+
valType: 'number',
79+
min: 0,
80+
max: 1,
81+
dflt: 0,
82+
role: 'style',
83+
description: [
84+
"Specifies what fraction of the marker area is covered with the",
85+
"border."
86+
].join(' ')
87+
}
88+
}
89+
}
2290
};

src/traces/pointcloud/convert.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function Pointcloud(scene, uid) {
3535

3636
this.pointcloudOptions = {
3737
positions: new Float32Array(0),
38-
size: 12,
38+
sizemin: 0.5,
3939
color: [0, 0, 0, 1],
4040
borderSize: 1,
4141
borderColor: [0, 0, 0, 1]
@@ -60,9 +60,7 @@ proto.handlePick = function(pickResult) {
6060
textLabel: Array.isArray(this.textLabels) ?
6161
this.textLabels[index] :
6262
this.textLabels,
63-
color: Array.isArray(this.color) ?
64-
this.color[index] :
65-
this.color,
63+
color: this.color,
6664
name: this.name,
6765
hoverinfo: this.hoverinfo
6866
};
@@ -121,7 +119,7 @@ proto.updateFast = function(options) {
121119
this.pointcloudOptions.positions = positions;
122120

123121
var markerColor = str2RGBArray(options.marker.color),
124-
borderColor = str2RGBArray(options.marker.line.color),
122+
borderColor = str2RGBArray(options.marker.border.color),
125123
opacity = options.opacity * options.marker.opacity;
126124

127125
markerColor[3] *= opacity;
@@ -130,9 +128,9 @@ proto.updateFast = function(options) {
130128
borderColor[3] *= opacity;
131129
this.pointcloudOptions.borderColor = borderColor;
132130

133-
markerSize = options.marker.size;
131+
markerSize = options.marker.sizemin;
134132
this.pointcloudOptions.size = markerSize;
135-
this.pointcloudOptions.borderSize = options.marker.line.width;
133+
this.pointcloudOptions.borderSize = options.marker.border.arearatio;
136134

137135
this.pointcloud.update(this.pointcloudOptions);
138136

src/traces/pointcloud/defaults.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
var Lib = require('../../lib');
1313

1414
var handleXYDefaults = require('../scatter/xy_defaults');
15-
var handleMarkerDefaults = require('../scatter/marker_defaults');
1615

1716
var attributes = require('./attributes');
1817

@@ -28,6 +27,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
2827
}
2928

3029
coerce('text');
31-
32-
handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce);
30+
coerce('marker.color', defaultColor);
31+
coerce('marker.opacity'/*, isBubble ? 0.7 : 1*/);
32+
coerce('marker.sizemin');
33+
coerce('marker.sizemax');
34+
coerce('marker.border.color', defaultColor);
35+
coerce('marker.border.arearatio');
3336
};

0 commit comments

Comments
 (0)