Skip to content

Commit 6074b33

Browse files
committed
keep scatter3d d.color as an array
1 parent 58fd10e commit 6074b33

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/traces/scatter3d/convert.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ function convertPlotlyOptions(scene, data) {
331331
return params;
332332
}
333333

334-
function arrayToColor(color) {
335-
if(Array.isArray(color)) {
334+
function _arrayToColor(color) {
335+
if(Lib.isArrayOrTypedArray(color)) {
336336
var c = color[0];
337337

338-
if(Array.isArray(c)) color = c;
338+
if(Lib.isArrayOrTypedArray(c)) color = c;
339339

340340
return 'rgb(' + color.slice(0, 3).map(function(x) {
341341
return Math.round(x * 255);
@@ -345,6 +345,16 @@ function arrayToColor(color) {
345345
return null;
346346
}
347347

348+
function arrayToColor(colors) {
349+
if(!Lib.isArrayOrTypedArray(colors)) {
350+
return _arrayToColor(colors);
351+
}
352+
353+
return colors.map(function(color) {
354+
return _arrayToColor(color);
355+
});
356+
}
357+
348358
proto.update = function(data) {
349359
var gl = this.scene.glplot.gl;
350360
var lineOptions;

0 commit comments

Comments
 (0)