Skip to content

Commit 064a80a

Browse files
committed
make scatter3d marker.opacity explicitly arrayOk: false,
- which reflects the logic in the convert step - add custom description for scatter3d marker.opacity
1 parent 7e97ff1 commit 064a80a

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/traces/scatter3d/attributes.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,17 @@ module.exports = {
114114
sizeref: scatterMarkerAttrs.sizeref,
115115
sizemin: scatterMarkerAttrs.sizemin,
116116
sizemode: scatterMarkerAttrs.sizemode,
117-
opacity: scatterMarkerAttrs.opacity,
117+
opacity: extendFlat({}, scatterMarkerAttrs.opacity, {
118+
arrayOk: false,
119+
description: [
120+
'Sets the marker opacity.',
121+
'Note that the marker opacity for scatter3d traces',
122+
'must be a scalar value for performance reasons.',
123+
'To set a blending opacity value',
124+
'(i.e. which is not transparent), set *marker.color*',
125+
'to an rgba color and use its alpha channel.'
126+
].join(' ')
127+
}),
118128
colorscale: scatterMarkerAttrs.colorscale,
119129
cauto: scatterMarkerAttrs.cauto,
120130
cmax: scatterMarkerAttrs.cmax,

src/traces/scatter3d/convert.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,9 @@ proto.update = function(data) {
319319
this.linePlot = null;
320320
}
321321

322+
// N.B. marker.opacity must be a scalar for performance
322323
var scatterOpacity = data.opacity;
323-
if(data.marker && typeof data.marker.opacity === 'number') {
324-
scatterOpacity *= data.marker.opacity;
325-
}
324+
if(data.marker && data.marker.opacity) scatterOpacity *= data.marker.opacity;
326325

327326
scatterOptions = {
328327
gl: gl,

0 commit comments

Comments
 (0)