Skip to content

Commit bf3f875

Browse files
committed
Merge pull request #114 from plotly/marker-opacity-3d
Reflect scatter3d marker opacity reality in attributes
2 parents e0add44 + 064a80a commit bf3f875

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

devtools/test_dashboard/test_gl3d.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ plots['triangle-mesh3d'] = require('@mocks/gl3d_triangle.json');
2626
plots['snowden'] = require('@mocks/gl3d_snowden.json');
2727
plots['bunny'] = require('@mocks/gl3d_bunny.json');
2828
plots['ribbons'] = require('@mocks/gl3d_ribbons.json');
29-
plots['date-time'] = require('@mocks/gl3d_scatter-date.json');
29+
plots['scatter-time'] = require('@mocks/gl3d_scatter-date.json');
3030
plots['cufflinks'] = require('@mocks/gl3d_cufflinks.json');
3131
plots['chrisp-nan-1'] = require('@mocks/gl3d_chrisp-nan-1.json');
3232
plots['marker-arrays'] = require('@mocks/gl3d_marker-arrays.json');

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
@@ -318,10 +318,9 @@ proto.update = function(data) {
318318
this.linePlot = null;
319319
}
320320

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

326325
scatterOptions = {
327326
gl: gl,

0 commit comments

Comments
 (0)