diff --git a/package-lock.json b/package-lock.json index 6c301107e90..bdbfa224fe0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4610,9 +4610,9 @@ } }, "gl-mesh3d": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/gl-mesh3d/-/gl-mesh3d-2.1.3.tgz", - "integrity": "sha512-c1zMvkVoKrVPSn/YA0JTDE/I289xqAjkH52HZBLvEGmKAg0Ezwi/Llg1M7NPIb4d5nwekCBMXGZmemsZaedI5g==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/gl-mesh3d/-/gl-mesh3d-2.2.0.tgz", + "integrity": "sha512-wO6EKjBUo/k7ZLGsMACWGETjmjfsGwwoDWEKjDbjyjo1qPvgkTQQB9Y8p+OKGjE6GeihsfQuoqGBUTu9tiAOmg==", "requires": { "barycentric": "^1.0.1", "colormap": "^2.3.1", diff --git a/package.json b/package.json index f63d2dcbe30..65649f9c5cd 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "gl-heatmap2d": "^1.0.5", "gl-line3d": "^1.1.11", "gl-mat4": "^1.2.0", - "gl-mesh3d": "^2.1.3", + "gl-mesh3d": "^2.2.0", "gl-plot2d": "^1.4.2", "gl-plot3d": "^2.3.0", "gl-pointcloud2d": "^1.0.2", diff --git a/src/traces/mesh3d/attributes.js b/src/traces/mesh3d/attributes.js index 9641ae6ef1a..fa5bf529c14 100644 --- a/src/traces/mesh3d/attributes.js +++ b/src/traces/mesh3d/attributes.js @@ -144,8 +144,19 @@ module.exports = extendFlat({ valType: 'data_array', editType: 'calc', description: [ - 'Sets the vertex intensity values,', - 'used for plotting fields on meshes' + 'Sets the intensity values for vertices or cells', + 'as defined by `intensitymode`.', + 'It can be used for plotting fields on meshes.' + ].join(' ') + }, + intensitymode: { + valType: 'enumerated', + values: ['vertex', 'cell'], + dflt: 'vertex', + editType: 'calc', + role: 'info', + description: [ + 'Determines the source of `intensity` values.' ].join(' ') }, diff --git a/src/traces/mesh3d/convert.js b/src/traces/mesh3d/convert.js index bc9b69ebfa4..7d8a4d35adf 100644 --- a/src/traces/mesh3d/convert.js +++ b/src/traces/mesh3d/convert.js @@ -160,8 +160,9 @@ proto.update = function(data) { if(data.intensity) { var cOpts = extractOpts(data); this.color = '#fff'; - config.vertexIntensity = data.intensity; - config.vertexIntensityBounds = [cOpts.min, cOpts.max]; + var mode = data.intensitymode; + config[mode + 'Intensity'] = data.intensity; + config[mode + 'IntensityBounds'] = [cOpts.min, cOpts.max]; config.colormap = parseColorScale(data); } else if(data.vertexcolor) { this.color = data.vertexcolor[0]; diff --git a/src/traces/mesh3d/defaults.js b/src/traces/mesh3d/defaults.js index fa4299a99cb..29b9e77088d 100644 --- a/src/traces/mesh3d/defaults.js +++ b/src/traces/mesh3d/defaults.js @@ -79,6 +79,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if('intensity' in traceIn) { coerce('intensity'); + coerce('intensitymode'); colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}); } else { traceOut.showscale = false; diff --git a/test/image/baselines/gl3d_mesh3d_cell-intensity.png b/test/image/baselines/gl3d_mesh3d_cell-intensity.png new file mode 100644 index 00000000000..6dceac35977 Binary files /dev/null and b/test/image/baselines/gl3d_mesh3d_cell-intensity.png differ diff --git a/test/image/mocks/gl3d_mesh3d_cell-intensity.json b/test/image/mocks/gl3d_mesh3d_cell-intensity.json new file mode 100644 index 00000000000..84c774fa419 --- /dev/null +++ b/test/image/mocks/gl3d_mesh3d_cell-intensity.json @@ -0,0 +1,2050 @@ +{ + "data": [ + { + "x": [ + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0, + 0.1, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.1, + 0.2, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.2, + 0.3, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.3, + 0.4, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.4, + 0.5, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.5, + 0.6, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.6, + 0.7, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.7, + 0.8, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.8, + 0.9, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1, + 0.9, + 1 + ], + "y": [ + 0, + 0, + 0.1, + 0.1, + 0.1, + 0.1, + 0.2, + 0.2, + 0.2, + 0.2, + 0.3, + 0.3, + 0.3, + 0.3, + 0.4, + 0.4, + 0.4, + 0.4, + 0.5, + 0.5, + 0.5, + 0.5, + 0.6, + 0.6, + 0.6, + 0.6, + 0.7, + 0.7, + 0.7, + 0.7, + 0.8, + 0.8, + 0.8, + 0.8, + 0.9, + 0.9, + 0.9, + 0.9, + 1, + 1, + 0, + 0, + 0.1, + 0.1, + 0.1, + 0.1, + 0.2, + 0.2, + 0.2, + 0.2, + 0.3, + 0.3, + 0.3, + 0.3, + 0.4, + 0.4, + 0.4, + 0.4, + 0.5, + 0.5, + 0.5, + 0.5, + 0.6, + 0.6, + 0.6, + 0.6, + 0.7, + 0.7, + 0.7, + 0.7, + 0.8, + 0.8, + 0.8, + 0.8, + 0.9, + 0.9, + 0.9, + 0.9, + 1, + 1, + 0, + 0, + 0.1, + 0.1, + 0.1, + 0.1, + 0.2, + 0.2, + 0.2, + 0.2, + 0.3, + 0.3, + 0.3, + 0.3, + 0.4, + 0.4, + 0.4, + 0.4, + 0.5, + 0.5, + 0.5, + 0.5, + 0.6, + 0.6, + 0.6, + 0.6, + 0.7, + 0.7, + 0.7, + 0.7, + 0.8, + 0.8, + 0.8, + 0.8, + 0.9, + 0.9, + 0.9, + 0.9, + 1, + 1, + 0, + 0, + 0.1, + 0.1, + 0.1, + 0.1, + 0.2, + 0.2, + 0.2, + 0.2, + 0.3, + 0.3, + 0.3, + 0.3, + 0.4, + 0.4, + 0.4, + 0.4, + 0.5, + 0.5, + 0.5, + 0.5, + 0.6, + 0.6, + 0.6, + 0.6, + 0.7, + 0.7, + 0.7, + 0.7, + 0.8, + 0.8, + 0.8, + 0.8, + 0.9, + 0.9, + 0.9, + 0.9, + 1, + 1, + 0, + 0, + 0.1, + 0.1, + 0.1, + 0.1, + 0.2, + 0.2, + 0.2, + 0.2, + 0.3, + 0.3, + 0.3, + 0.3, + 0.4, + 0.4, + 0.4, + 0.4, + 0.5, + 0.5, + 0.5, + 0.5, + 0.6, + 0.6, + 0.6, + 0.6, + 0.7, + 0.7, + 0.7, + 0.7, + 0.8, + 0.8, + 0.8, + 0.8, + 0.9, + 0.9, + 0.9, + 0.9, + 1, + 1, + 0, + 0, + 0.1, + 0.1, + 0.1, + 0.1, + 0.2, + 0.2, + 0.2, + 0.2, + 0.3, + 0.3, + 0.3, + 0.3, + 0.4, + 0.4, + 0.4, + 0.4, + 0.5, + 0.5, + 0.5, + 0.5, + 0.6, + 0.6, + 0.6, + 0.6, + 0.7, + 0.7, + 0.7, + 0.7, + 0.8, + 0.8, + 0.8, + 0.8, + 0.9, + 0.9, + 0.9, + 0.9, + 1, + 1, + 0, + 0, + 0.1, + 0.1, + 0.1, + 0.1, + 0.2, + 0.2, + 0.2, + 0.2, + 0.3, + 0.3, + 0.3, + 0.3, + 0.4, + 0.4, + 0.4, + 0.4, + 0.5, + 0.5, + 0.5, + 0.5, + 0.6, + 0.6, + 0.6, + 0.6, + 0.7, + 0.7, + 0.7, + 0.7, + 0.8, + 0.8, + 0.8, + 0.8, + 0.9, + 0.9, + 0.9, + 0.9, + 1, + 1, + 0, + 0, + 0.1, + 0.1, + 0.1, + 0.1, + 0.2, + 0.2, + 0.2, + 0.2, + 0.3, + 0.3, + 0.3, + 0.3, + 0.4, + 0.4, + 0.4, + 0.4, + 0.5, + 0.5, + 0.5, + 0.5, + 0.6, + 0.6, + 0.6, + 0.6, + 0.7, + 0.7, + 0.7, + 0.7, + 0.8, + 0.8, + 0.8, + 0.8, + 0.9, + 0.9, + 0.9, + 0.9, + 1, + 1, + 0, + 0, + 0.1, + 0.1, + 0.1, + 0.1, + 0.2, + 0.2, + 0.2, + 0.2, + 0.3, + 0.3, + 0.3, + 0.3, + 0.4, + 0.4, + 0.4, + 0.4, + 0.5, + 0.5, + 0.5, + 0.5, + 0.6, + 0.6, + 0.6, + 0.6, + 0.7, + 0.7, + 0.7, + 0.7, + 0.8, + 0.8, + 0.8, + 0.8, + 0.9, + 0.9, + 0.9, + 0.9, + 1, + 1, + 0, + 0, + 0.1, + 0.1, + 0.1, + 0.1, + 0.2, + 0.2, + 0.2, + 0.2, + 0.3, + 0.3, + 0.3, + 0.3, + 0.4, + 0.4, + 0.4, + 0.4, + 0.5, + 0.5, + 0.5, + 0.5, + 0.6, + 0.6, + 0.6, + 0.6, + 0.7, + 0.7, + 0.7, + 0.7, + 0.8, + 0.8, + 0.8, + 0.8, + 0.9, + 0.9, + 0.9, + 0.9, + 1, + 1 + ], + "z": [ + 1, + 0.951, + 0.951, + 0.905, + 0.951, + 0.905, + 0.809, + 0.769, + 0.809, + 0.769, + 0.588, + 0.559, + 0.588, + 0.559, + 0.309, + 0.294, + 0.309, + 0.294, + 0, + 0, + 0, + 0, + -0.309, + -0.294, + -0.309, + -0.294, + -0.588, + -0.559, + -0.588, + -0.559, + -0.809, + -0.769, + -0.809, + -0.769, + -0.951, + -0.905, + -0.951, + -0.905, + -1, + -0.951, + 0.951, + 0.809, + 0.905, + 0.769, + 0.905, + 0.769, + 0.769, + 0.655, + 0.769, + 0.655, + 0.559, + 0.476, + 0.559, + 0.476, + 0.294, + 0.25, + 0.294, + 0.25, + 0, + 0, + 0, + 0, + -0.294, + -0.25, + -0.294, + -0.25, + -0.559, + -0.476, + -0.559, + -0.476, + -0.769, + -0.655, + -0.769, + -0.655, + -0.905, + -0.769, + -0.905, + -0.769, + -0.951, + -0.809, + 0.809, + 0.588, + 0.769, + 0.559, + 0.769, + 0.559, + 0.655, + 0.476, + 0.655, + 0.476, + 0.476, + 0.345, + 0.476, + 0.345, + 0.25, + 0.182, + 0.25, + 0.182, + 0, + 0, + 0, + 0, + -0.25, + -0.182, + -0.25, + -0.182, + -0.476, + -0.345, + -0.476, + -0.345, + -0.655, + -0.476, + -0.655, + -0.476, + -0.769, + -0.559, + -0.769, + -0.559, + -0.809, + -0.588, + 0.588, + 0.309, + 0.559, + 0.294, + 0.559, + 0.294, + 0.476, + 0.25, + 0.476, + 0.25, + 0.345, + 0.182, + 0.345, + 0.182, + 0.182, + 0.095, + 0.182, + 0.095, + 0, + 0, + 0, + 0, + -0.182, + -0.095, + -0.182, + -0.095, + -0.345, + -0.182, + -0.345, + -0.182, + -0.476, + -0.25, + -0.476, + -0.25, + -0.559, + -0.294, + -0.559, + -0.294, + -0.588, + -0.309, + 0.309, + 0, + 0.294, + 0, + 0.294, + 0, + 0.25, + 0, + 0.25, + 0, + 0.182, + 0, + 0.182, + 0, + 0.095, + 0, + 0.095, + 0, + 0, + 0, + 0, + 0, + -0.095, + 0, + -0.095, + 0, + -0.182, + 0, + -0.182, + 0, + -0.25, + 0, + -0.25, + 0, + -0.294, + 0, + -0.294, + 0, + -0.309, + 0, + 0, + -0.309, + 0, + -0.294, + 0, + -0.294, + 0, + -0.25, + 0, + -0.25, + 0, + -0.182, + 0, + -0.182, + 0, + -0.095, + 0, + -0.095, + 0, + 0, + 0, + 0, + 0, + 0.095, + 0, + 0.095, + 0, + 0.182, + 0, + 0.182, + 0, + 0.25, + 0, + 0.25, + 0, + 0.294, + 0, + 0.294, + 0, + 0.309, + -0.309, + -0.588, + -0.294, + -0.559, + -0.294, + -0.559, + -0.25, + -0.476, + -0.25, + -0.476, + -0.182, + -0.345, + -0.182, + -0.345, + -0.095, + -0.182, + -0.095, + -0.182, + 0, + 0, + 0, + 0, + 0.095, + 0.182, + 0.095, + 0.182, + 0.182, + 0.345, + 0.182, + 0.345, + 0.25, + 0.476, + 0.25, + 0.476, + 0.294, + 0.559, + 0.294, + 0.559, + 0.309, + 0.588, + -0.588, + -0.809, + -0.559, + -0.769, + -0.559, + -0.769, + -0.476, + -0.655, + -0.476, + -0.655, + -0.345, + -0.476, + -0.345, + -0.476, + -0.182, + -0.25, + -0.182, + -0.25, + 0, + 0, + 0, + 0, + 0.182, + 0.25, + 0.182, + 0.25, + 0.345, + 0.476, + 0.345, + 0.476, + 0.476, + 0.655, + 0.476, + 0.655, + 0.559, + 0.769, + 0.559, + 0.769, + 0.588, + 0.809, + -0.809, + -0.951, + -0.769, + -0.905, + -0.769, + -0.905, + -0.655, + -0.769, + -0.655, + -0.769, + -0.476, + -0.559, + -0.476, + -0.559, + -0.25, + -0.294, + -0.25, + -0.294, + 0, + 0, + 0, + 0, + 0.25, + 0.294, + 0.25, + 0.294, + 0.476, + 0.559, + 0.476, + 0.559, + 0.655, + 0.769, + 0.655, + 0.769, + 0.769, + 0.905, + 0.769, + 0.905, + 0.809, + 0.951, + -0.951, + -1, + -0.905, + -0.951, + -0.905, + -0.951, + -0.769, + -0.809, + -0.769, + -0.809, + -0.559, + -0.588, + -0.559, + -0.588, + -0.294, + -0.309, + -0.294, + -0.309, + 0, + 0, + 0, + 0, + 0.294, + 0.309, + 0.294, + 0.309, + 0.559, + 0.588, + 0.559, + 0.588, + 0.769, + 0.809, + 0.769, + 0.809, + 0.905, + 0.951, + 0.905, + 0.951, + 0.951, + 1 + ], + "i": [ + 0, + 3, + 4, + 7, + 8, + 11, + 12, + 15, + 16, + 19, + 20, + 23, + 24, + 27, + 28, + 31, + 32, + 35, + 36, + 39, + 40, + 43, + 44, + 47, + 48, + 51, + 52, + 55, + 56, + 59, + 60, + 63, + 64, + 67, + 68, + 71, + 72, + 75, + 76, + 79, + 80, + 83, + 84, + 87, + 88, + 91, + 92, + 95, + 96, + 99, + 100, + 103, + 104, + 107, + 108, + 111, + 112, + 115, + 116, + 119, + 120, + 123, + 124, + 127, + 128, + 131, + 132, + 135, + 136, + 139, + 140, + 143, + 144, + 147, + 148, + 151, + 152, + 155, + 156, + 159, + 160, + 163, + 164, + 167, + 168, + 171, + 172, + 175, + 176, + 179, + 180, + 183, + 184, + 187, + 188, + 191, + 192, + 195, + 196, + 199, + 200, + 203, + 204, + 207, + 208, + 211, + 212, + 215, + 216, + 219, + 220, + 223, + 224, + 227, + 228, + 231, + 232, + 235, + 236, + 239, + 240, + 243, + 244, + 247, + 248, + 251, + 252, + 255, + 256, + 259, + 260, + 263, + 264, + 267, + 268, + 271, + 272, + 275, + 276, + 279, + 280, + 283, + 284, + 287, + 288, + 291, + 292, + 295, + 296, + 299, + 300, + 303, + 304, + 307, + 308, + 311, + 312, + 315, + 316, + 319, + 320, + 323, + 324, + 327, + 328, + 331, + 332, + 335, + 336, + 339, + 340, + 343, + 344, + 347, + 348, + 351, + 352, + 355, + 356, + 359, + 360, + 363, + 364, + 367, + 368, + 371, + 372, + 375, + 376, + 379, + 380, + 383, + 384, + 387, + 388, + 391, + 392, + 395, + 396, + 399 + ], + "j": [ + 1, + 2, + 5, + 6, + 9, + 10, + 13, + 14, + 17, + 18, + 21, + 22, + 25, + 26, + 29, + 30, + 33, + 34, + 37, + 38, + 41, + 42, + 45, + 46, + 49, + 50, + 53, + 54, + 57, + 58, + 61, + 62, + 65, + 66, + 69, + 70, + 73, + 74, + 77, + 78, + 81, + 82, + 85, + 86, + 89, + 90, + 93, + 94, + 97, + 98, + 101, + 102, + 105, + 106, + 109, + 110, + 113, + 114, + 117, + 118, + 121, + 122, + 125, + 126, + 129, + 130, + 133, + 134, + 137, + 138, + 141, + 142, + 145, + 146, + 149, + 150, + 153, + 154, + 157, + 158, + 161, + 162, + 165, + 166, + 169, + 170, + 173, + 174, + 177, + 178, + 181, + 182, + 185, + 186, + 189, + 190, + 193, + 194, + 197, + 198, + 201, + 202, + 205, + 206, + 209, + 210, + 213, + 214, + 217, + 218, + 221, + 222, + 225, + 226, + 229, + 230, + 233, + 234, + 237, + 238, + 241, + 242, + 245, + 246, + 249, + 250, + 253, + 254, + 257, + 258, + 261, + 262, + 265, + 266, + 269, + 270, + 273, + 274, + 277, + 278, + 281, + 282, + 285, + 286, + 289, + 290, + 293, + 294, + 297, + 298, + 301, + 302, + 305, + 306, + 309, + 310, + 313, + 314, + 317, + 318, + 321, + 322, + 325, + 326, + 329, + 330, + 333, + 334, + 337, + 338, + 341, + 342, + 345, + 346, + 349, + 350, + 353, + 354, + 357, + 358, + 361, + 362, + 365, + 366, + 369, + 370, + 373, + 374, + 377, + 378, + 381, + 382, + 385, + 386, + 389, + 390, + 393, + 394, + 397, + 398 + ], + "k": [ + 3, + 0, + 7, + 4, + 11, + 8, + 15, + 12, + 19, + 16, + 23, + 20, + 27, + 24, + 31, + 28, + 35, + 32, + 39, + 36, + 43, + 40, + 47, + 44, + 51, + 48, + 55, + 52, + 59, + 56, + 63, + 60, + 67, + 64, + 71, + 68, + 75, + 72, + 79, + 76, + 83, + 80, + 87, + 84, + 91, + 88, + 95, + 92, + 99, + 96, + 103, + 100, + 107, + 104, + 111, + 108, + 115, + 112, + 119, + 116, + 123, + 120, + 127, + 124, + 131, + 128, + 135, + 132, + 139, + 136, + 143, + 140, + 147, + 144, + 151, + 148, + 155, + 152, + 159, + 156, + 163, + 160, + 167, + 164, + 171, + 168, + 175, + 172, + 179, + 176, + 183, + 180, + 187, + 184, + 191, + 188, + 195, + 192, + 199, + 196, + 203, + 200, + 207, + 204, + 211, + 208, + 215, + 212, + 219, + 216, + 223, + 220, + 227, + 224, + 231, + 228, + 235, + 232, + 239, + 236, + 243, + 240, + 247, + 244, + 251, + 248, + 255, + 252, + 259, + 256, + 263, + 260, + 267, + 264, + 271, + 268, + 275, + 272, + 279, + 276, + 283, + 280, + 287, + 284, + 291, + 288, + 295, + 292, + 299, + 296, + 303, + 300, + 307, + 304, + 311, + 308, + 315, + 312, + 319, + 316, + 323, + 320, + 327, + 324, + 331, + 328, + 335, + 332, + 339, + 336, + 343, + 340, + 347, + 344, + 351, + 348, + 355, + 352, + 359, + 356, + 363, + 360, + 367, + 364, + 371, + 368, + 375, + 372, + 379, + 376, + 383, + 380, + 387, + 384, + 391, + 388, + 395, + 392, + 399, + 396 + ], + "intensitymode": "cell", + "intensity": [ + 6.56, + 6.56, + 5.28, + 5.28, + 4.32, + 4.32, + 3.68, + 3.68, + 3.36, + 3.36, + 3.36, + 3.36, + 3.68, + 3.68, + 4.32, + 4.32, + 5.28, + 5.28, + 6.56, + 6.56, + 5.28, + 5.28, + 4, + 4, + 3.04, + 3.04, + 2.4, + 2.4, + 2.08, + 2.08, + 2.08, + 2.08, + 2.4, + 2.4, + 3.04, + 3.04, + 4, + 4, + 5.28, + 5.28, + 4.32, + 4.32, + 3.04, + 3.04, + 2.08, + 2.08, + 1.44, + 1.44, + 1.12, + 1.12, + 1.12, + 1.12, + 1.44, + 1.44, + 2.08, + 2.08, + 3.04, + 3.04, + 4.32, + 4.32, + 3.68, + 3.68, + 2.4, + 2.4, + 1.44, + 1.44, + 0.8, + 0.8, + 0.48, + 0.48, + 0.48, + 0.48, + 0.8, + 0.8, + 1.44, + 1.44, + 2.4, + 2.4, + 3.68, + 3.68, + 3.36, + 3.36, + 2.08, + 2.08, + 1.12, + 1.12, + 0.48, + 0.48, + 0.16, + 0.16, + 0.16, + 0.16, + 0.48, + 0.48, + 1.12, + 1.12, + 2.08, + 2.08, + 3.36, + 3.36, + 3.36, + 3.36, + 2.08, + 2.08, + 1.12, + 1.12, + 0.48, + 0.48, + 0.16, + 0.16, + 0.16, + 0.16, + 0.48, + 0.48, + 1.12, + 1.12, + 2.08, + 2.08, + 3.36, + 3.36, + 3.68, + 3.68, + 2.4, + 2.4, + 1.44, + 1.44, + 0.8, + 0.8, + 0.48, + 0.48, + 0.48, + 0.48, + 0.8, + 0.8, + 1.44, + 1.44, + 2.4, + 2.4, + 3.68, + 3.68, + 4.32, + 4.32, + 3.04, + 3.04, + 2.08, + 2.08, + 1.44, + 1.44, + 1.12, + 1.12, + 1.12, + 1.12, + 1.44, + 1.44, + 2.08, + 2.08, + 3.04, + 3.04, + 4.32, + 4.32, + 5.28, + 5.28, + 4, + 4, + 3.04, + 3.04, + 2.4, + 2.4, + 2.08, + 2.08, + 2.08, + 2.08, + 2.4, + 2.4, + 3.04, + 3.04, + 4, + 4, + 5.28, + 5.28, + 6.56, + 6.56, + 5.28, + 5.28, + 4.32, + 4.32, + 3.68, + 3.68, + 3.36, + 3.36, + 3.36, + 3.36, + 3.68, + 3.68, + 4.32, + 4.32, + 5.28, + 5.28, + 6.56, + 6.56 + ], + "flatshading": true, + "lighting": { + "facenormalsepsilon": 0 + }, + "type": "mesh3d" + } + ], + "layout": { + "width": 500, + "height": 400, + "margin": { + "t": 0, + "b": 0, + "l": 0, + "r": 0 + }, + "scene": { + "aspectratio": { + "x": 1, + "y": 1, + "z": 1 + }, + "camera": { + "eye": { + "x": 1.5, + "y": -1.5, + "z": 1.5 + } + } + } + } +} diff --git a/test/jasmine/tests/mesh3d_test.js b/test/jasmine/tests/mesh3d_test.js index a47774893aa..49ed39443b0 100644 --- a/test/jasmine/tests/mesh3d_test.js +++ b/test/jasmine/tests/mesh3d_test.js @@ -132,7 +132,7 @@ describe('Test mesh3d', function() { expect(traceOut.contour.width).toBeUndefined(); }); - it('should coerce colorscale and colorbar attributes when intensity is present', function() { + it('should coerce colorscale and colorbar attributes as well as intensitymode when intensity is present', function() { traceIn = { x: [0, 1, 0, 1, 0, 1, 0, 1], y: [0, 0, 1, 1, 0, 0, 1, 1], @@ -158,9 +158,10 @@ describe('Test mesh3d', function() { expect(traceOut.reversescale).toBe(false); expect(traceOut.showscale).toBe(true); expect(traceOut.colorbar).toBeDefined(); + expect(traceOut.intensitymode).toBe('vertex'); }); - it('should not coerce colorscale and colorbar attributes when intensity is not present', function() { + it('should not coerce colorscale and colorbar attributes as well as intensitymode when intensity is not present', function() { traceIn = { x: [0, 1, 0, 1, 0, 1, 0, 1], y: [0, 0, 1, 1, 0, 0, 1, 1], @@ -178,6 +179,7 @@ describe('Test mesh3d', function() { expect(traceOut.reversescale).toBeUndefined(); expect(traceOut.showscale).toBe(false); expect(traceOut.colorbar).toBeUndefined(); + expect(traceOut.intensitymode).toBeUndefined(); }); it('should inherit layout.calendar', function() {