diff --git a/src/traces/mesh3d/attributes.js b/src/traces/mesh3d/attributes.js index 3796850f51a..cfc573724fc 100644 --- a/src/traces/mesh3d/attributes.js +++ b/src/traces/mesh3d/attributes.js @@ -125,7 +125,7 @@ module.exports = { description: 'Sets the color of the whole mesh' }, vertexcolor: { - valType: 'data_array', // FIXME: this should be a color array + valType: 'data_array', role: 'style', description: [ 'Sets the color of each vertex', diff --git a/src/traces/mesh3d/convert.js b/src/traces/mesh3d/convert.js index ddbf71feaca..bf675bb7f8e 100644 --- a/src/traces/mesh3d/convert.js +++ b/src/traces/mesh3d/convert.js @@ -127,7 +127,7 @@ proto.update = function(data) { config.colormap = parseColorScale(data.colorscale); } else if(data.vertexcolor) { - this.color = data.vertexcolors[0]; + this.color = data.vertexcolor[0]; config.vertexColors = parseColorArray(data.vertexcolor); } else if(data.facecolor) { diff --git a/src/traces/mesh3d/defaults.js b/src/traces/mesh3d/defaults.js index d731a077cf3..87ff1aabf1c 100644 --- a/src/traces/mesh3d/defaults.js +++ b/src/traces/mesh3d/defaults.js @@ -82,8 +82,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout else { traceOut.showscale = false; - if('vertexcolor' in traceIn) coerce('vertexcolor'); - else if('facecolor' in traceIn) coerce('facecolor'); + if('facecolor' in traceIn) coerce('facecolor'); + else if('vertexcolor' in traceIn) coerce('vertexcolor'); else coerce('color', defaultColor); } diff --git a/test/image/baselines/gl3d_tet.png b/test/image/baselines/gl3d_tet.png deleted file mode 100644 index 12738c7cd2a..00000000000 Binary files a/test/image/baselines/gl3d_tet.png and /dev/null differ diff --git a/test/image/baselines/gl3d_tet_colorscale.png b/test/image/baselines/gl3d_tet_colorscale.png deleted file mode 100644 index 0949182b9b2..00000000000 Binary files a/test/image/baselines/gl3d_tet_colorscale.png and /dev/null differ diff --git a/test/image/baselines/gl3d_tetrahedra.png b/test/image/baselines/gl3d_tetrahedra.png new file mode 100644 index 00000000000..f64a8318027 Binary files /dev/null and b/test/image/baselines/gl3d_tetrahedra.png differ diff --git a/test/image/mocks/gl3d_tet.json b/test/image/mocks/gl3d_tet.json deleted file mode 100644 index 4fc000b0fdf..00000000000 --- a/test/image/mocks/gl3d_tet.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": [ - { - "type":"mesh3d", - "y":[0, 0, 1, 2], - "x":[0, 1, 2, 0], - "z":[0, 2, 0, 1], - "i":[0, 0, 0, 1], - "j":[1, 2, 3, 2], - "k":[2, 3, 1, 3], - "facecolor": [ - "rgb(0, 0, 0)", - "rgb(255, 0, 0)", - "rgb(0, 255, 0)", - "rgb(0, 0, 255)" - ] - }], - "layout": { - "title": "Tetrahedra", - "scene": { - "camera": { - "eye": { - "x": 1.5, - "y": -1.5, - "z": 0.5 - } - } - } - } -} diff --git a/test/image/mocks/gl3d_tet_colorscale.json b/test/image/mocks/gl3d_tet_colorscale.json deleted file mode 100644 index 0319c93f8c8..00000000000 --- a/test/image/mocks/gl3d_tet_colorscale.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "data": [ - { - "type":"mesh3d", - "y":[0, 0, 1, 2], - "x":[0, 1, 2, 0], - "z":[0, 2, 0, 1], - "i":[0, 0, 0, 1], - "j":[1, 2, 3, 2], - "k":[2, 3, 1, 3], - "colorscale": [ - [0, "rgb(0, 0, 0)"], - [0.33, "rgb(255, 0, 0)"], - [0.66, "rgb(0, 255, 0)"], - [1, "rgb(0, 0, 255)"] - ], - "intensity": [0, 0.33, 0.66, 1] - }], - "layout": { - "title": "Tetrahedra Custom Colorscale" - } -} diff --git a/test/image/mocks/gl3d_tetrahedra.json b/test/image/mocks/gl3d_tetrahedra.json new file mode 100644 index 00000000000..62d45514e19 --- /dev/null +++ b/test/image/mocks/gl3d_tetrahedra.json @@ -0,0 +1,87 @@ +{ + "data": [ + { + "type":"mesh3d", + "name": "colorscale + intensity", + "x":[0, 1, 2, 0], + "y":[0, 0, 1, 2], + "z":[0, 2, 0, 1], + "i":[0, 0, 0, 1], + "j":[1, 2, 3, 2], + "k":[2, 3, 1, 3], + "colorscale": [ + [0, "rgb(0, 0, 0)"], + [0.33, "rgb(255, 0, 0)"], + [0.66, "rgb(0, 255, 0)"], + [1, "rgb(0, 0, 255)"] + ], + "intensity": [0, 0.33, 0.66, 1], + "colorbar": { + "x": 0, + "title": "for colorscale + intensity tetrahedra", + "titleside": "right" + } + }, + { + "type":"mesh3d", + "name": "facecolor", + "x":[3, 4, 5, 3], + "y":[0, 0, 1, 2], + "z":[0, 2, 0, 1], + "i":[0, 0, 0, 1], + "j":[1, 2, 3, 2], + "k":[2, 3, 1, 3], + "facecolor": [ + "rgb(0, 0, 0)", + "rgb(255, 0, 0)", + "rgb(0, 255, 0)", + "rgb(0, 0, 255)" + ] + }, + { + "type":"mesh3d", + "name": "vertexcolor", + "x":[6, 7, 8, 6], + "y":[0, 0, 1, 2], + "z":[0, 2, 0, 1], + "i":[0, 0, 0, 1], + "j":[1, 2, 3, 2], + "k":[2, 3, 1, 3], + "vertexcolor": [ + "rgb(0, 0, 0)", + "rgb(255, 0, 0)", + "rgb(0, 255, 0)", + "rgb(0, 0, 255)" + ] + }, + { + "type":"mesh3d", + "name": "color", + "x":[9, 10, 11, 9], + "y":[0, 0, 1, 2], + "z":[0, 2, 0, 1], + "i":[0, 0, 0, 1], + "j":[1, 2, 3, 2], + "k":[2, 3, 1, 3], + "color": "rgb(0, 255, 0)" + } + ], + "layout": { + "title": "Tetrahedra", + "scene": { + "aspectratio": { + "x": 5, + "y": 1, + "z": 1 + }, + "camera": { + "eye": { + "x": 0, + "y": -3, + "z": 1.8 + } + } + }, + "width": 1000 + } +}