diff --git a/lib/index.js b/lib/index.js index c578165aadd..ea309cde21a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -31,6 +31,7 @@ Plotly.register([ require('./scattergl'), require('./pointcloud'), + require('./heatmapgl'), require('./scattermapbox'), diff --git a/package.json b/package.json index 35519ce3b9e..17515ba7a89 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "gl-contour2d": "^1.1.2", "gl-error2d": "^1.2.1", "gl-error3d": "^1.0.0", - "gl-heatmap2d": "^1.0.2", + "gl-heatmap2d": "^1.0.3", "gl-line2d": "^1.4.1", "gl-line3d": "^1.1.0", "gl-mat4": "^1.1.2", diff --git a/src/traces/heatmapgl/attributes.js b/src/traces/heatmapgl/attributes.js index e00fd49a1ab..23617d4f332 100644 --- a/src/traces/heatmapgl/attributes.js +++ b/src/traces/heatmapgl/attributes.js @@ -10,5 +10,31 @@ var heatmapAttrs = require('../scatter/attributes'); +var colorscaleAttrs = require('../../components/colorscale/attributes'); +var colorbarAttrs = require('../../components/colorbar/attributes'); -module.exports = heatmapAttrs; +var extendFlat = require('../../lib/extend').extendFlat; + +var commonList = [ + 'z', + 'x', 'x0', 'dx', + 'y', 'y0', 'dy', + 'text', 'transpose', + 'xtype', 'ytype' +]; + +var attrs = {}; + +for(var i = 0; i < commonList.length; i++) { + var k = commonList[i]; + attrs[k] = heatmapAttrs[k]; +} + +extendFlat( + attrs, + colorscaleAttrs, + { autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) }, + { colorbar: colorbarAttrs } +); + +module.exports = attrs; diff --git a/src/traces/heatmapgl/index.js b/src/traces/heatmapgl/index.js index f8789310196..4d1c9e5e5cf 100644 --- a/src/traces/heatmapgl/index.js +++ b/src/traces/heatmapgl/index.js @@ -24,7 +24,7 @@ HeatmapGl.basePlotModule = require('../../plots/gl2d'); HeatmapGl.categories = ['gl2d', '2dMap']; HeatmapGl.meta = { description: [ - 'WebGL heatmap (beta)' + 'WebGL version of the heatmap trace type.' ].join(' ') }; diff --git a/test/image/baselines/gl2d_heatmapgl.png b/test/image/baselines/gl2d_heatmapgl.png new file mode 100644 index 00000000000..7ce04066489 Binary files /dev/null and b/test/image/baselines/gl2d_heatmapgl.png differ diff --git a/test/image/mocks/gl2d_heatmapgl.json b/test/image/mocks/gl2d_heatmapgl.json new file mode 100644 index 00000000000..768a74dead4 --- /dev/null +++ b/test/image/mocks/gl2d_heatmapgl.json @@ -0,0 +1,134 @@ +{ + "data": [ + { + "type": "heatmapgl", + "z": [ + [ + 125, + 106, + 89, + 74, + 61, + 50, + 41, + 34, + 29, + 26 + ], + [ + 116, + 97, + 80, + 65, + 52, + 41, + 32, + 25, + 20, + 17 + ], + [ + 109, + 90, + 73, + 58, + 45, + 34, + 25, + 18, + 13, + 10 + ], + [ + 104, + 85, + 68, + 53, + 40, + 29, + 20, + 13, + 8, + 5 + ], + [ + 101, + 82, + 65, + 50, + 37, + 26, + 17, + 10, + 5, + 2 + ], + [ + 100, + 81, + 64, + 49, + 36, + 25, + 16, + 9, + 4, + 1 + ], + [ + 101, + 82, + 65, + 50, + 37, + 26, + 17, + 10, + 5, + 2 + ], + [ + 104, + 85, + 68, + 53, + 40, + 29, + 20, + 13, + 8, + 5 + ], + [ + 109, + 90, + 73, + 58, + 45, + 34, + 25, + 18, + 13, + 10 + ], + [ + 116, + 97, + 80, + 65, + 52, + 41, + 32, + 25, + 20, + 17 + ] + ], + "colorscale": "Viridis" + } + ], + "layout": { + "height": 450, + "width": 550 + } +} diff --git a/test/jasmine/tests/gl2d_click_test.js b/test/jasmine/tests/gl2d_click_test.js index dd499dd6870..8e001d55873 100644 --- a/test/jasmine/tests/gl2d_click_test.js +++ b/test/jasmine/tests/gl2d_click_test.js @@ -12,6 +12,11 @@ var hasWebGLSupport = require('../assets/has_webgl_support'); var click = require('../assets/timed_click'); var hover = require('../assets/hover'); +// contourgl is not part of the dist plotly.js bundle initially +Plotly.register([ + require('@lib/contourgl') +]); + describe('Test hover and click interactions', function() { if(!hasWebGLSupport('gl2d_click_test')) return; diff --git a/test/jasmine/tests/gl2d_scatterplot_contour_test.js b/test/jasmine/tests/gl2d_scatterplot_contour_test.js index 2c6b34d5255..b0c65b9fda2 100644 --- a/test/jasmine/tests/gl2d_scatterplot_contour_test.js +++ b/test/jasmine/tests/gl2d_scatterplot_contour_test.js @@ -4,9 +4,8 @@ var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var d3 = require('d3'); -// heatmapgl & contourgl is not part of the dist plotly.js bundle initially +// contourgl is not part of the dist plotly.js bundle initially Plotly.register([ - require('@lib/heatmapgl'), require('@lib/contourgl') ]);