Skip to content

Commit 4d243a9

Browse files
authored
Merge pull request #1197 from plotly/heatmapgl-primetime
`heatmapgl` in main bundle
2 parents 2d20123 + c8d2076 commit 4d243a9

File tree

8 files changed

+170
-5
lines changed

8 files changed

+170
-5
lines changed

lib/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Plotly.register([
3131

3232
require('./scattergl'),
3333
require('./pointcloud'),
34+
require('./heatmapgl'),
3435

3536
require('./scattermapbox'),
3637

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"gl-contour2d": "^1.1.2",
6262
"gl-error2d": "^1.2.1",
6363
"gl-error3d": "^1.0.0",
64-
"gl-heatmap2d": "^1.0.2",
64+
"gl-heatmap2d": "^1.0.3",
6565
"gl-line2d": "^1.4.1",
6666
"gl-line3d": "^1.1.0",
6767
"gl-mat4": "^1.1.2",

src/traces/heatmapgl/attributes.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,31 @@
1010

1111

1212
var heatmapAttrs = require('../scatter/attributes');
13+
var colorscaleAttrs = require('../../components/colorscale/attributes');
14+
var colorbarAttrs = require('../../components/colorbar/attributes');
1315

14-
module.exports = heatmapAttrs;
16+
var extendFlat = require('../../lib/extend').extendFlat;
17+
18+
var commonList = [
19+
'z',
20+
'x', 'x0', 'dx',
21+
'y', 'y0', 'dy',
22+
'text', 'transpose',
23+
'xtype', 'ytype'
24+
];
25+
26+
var attrs = {};
27+
28+
for(var i = 0; i < commonList.length; i++) {
29+
var k = commonList[i];
30+
attrs[k] = heatmapAttrs[k];
31+
}
32+
33+
extendFlat(
34+
attrs,
35+
colorscaleAttrs,
36+
{ autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) },
37+
{ colorbar: colorbarAttrs }
38+
);
39+
40+
module.exports = attrs;

src/traces/heatmapgl/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ HeatmapGl.basePlotModule = require('../../plots/gl2d');
2424
HeatmapGl.categories = ['gl2d', '2dMap'];
2525
HeatmapGl.meta = {
2626
description: [
27-
'WebGL heatmap (beta)'
27+
'WebGL version of the heatmap trace type.'
2828
].join(' ')
2929
};
3030

68.1 KB
Loading

test/image/mocks/gl2d_heatmapgl.json

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{
2+
"data": [
3+
{
4+
"type": "heatmapgl",
5+
"z": [
6+
[
7+
125,
8+
106,
9+
89,
10+
74,
11+
61,
12+
50,
13+
41,
14+
34,
15+
29,
16+
26
17+
],
18+
[
19+
116,
20+
97,
21+
80,
22+
65,
23+
52,
24+
41,
25+
32,
26+
25,
27+
20,
28+
17
29+
],
30+
[
31+
109,
32+
90,
33+
73,
34+
58,
35+
45,
36+
34,
37+
25,
38+
18,
39+
13,
40+
10
41+
],
42+
[
43+
104,
44+
85,
45+
68,
46+
53,
47+
40,
48+
29,
49+
20,
50+
13,
51+
8,
52+
5
53+
],
54+
[
55+
101,
56+
82,
57+
65,
58+
50,
59+
37,
60+
26,
61+
17,
62+
10,
63+
5,
64+
2
65+
],
66+
[
67+
100,
68+
81,
69+
64,
70+
49,
71+
36,
72+
25,
73+
16,
74+
9,
75+
4,
76+
1
77+
],
78+
[
79+
101,
80+
82,
81+
65,
82+
50,
83+
37,
84+
26,
85+
17,
86+
10,
87+
5,
88+
2
89+
],
90+
[
91+
104,
92+
85,
93+
68,
94+
53,
95+
40,
96+
29,
97+
20,
98+
13,
99+
8,
100+
5
101+
],
102+
[
103+
109,
104+
90,
105+
73,
106+
58,
107+
45,
108+
34,
109+
25,
110+
18,
111+
13,
112+
10
113+
],
114+
[
115+
116,
116+
97,
117+
80,
118+
65,
119+
52,
120+
41,
121+
32,
122+
25,
123+
20,
124+
17
125+
]
126+
],
127+
"colorscale": "Viridis"
128+
}
129+
],
130+
"layout": {
131+
"height": 450,
132+
"width": 550
133+
}
134+
}

test/jasmine/tests/gl2d_click_test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ var hasWebGLSupport = require('../assets/has_webgl_support');
1212
var click = require('../assets/timed_click');
1313
var hover = require('../assets/hover');
1414

15+
// contourgl is not part of the dist plotly.js bundle initially
16+
Plotly.register([
17+
require('@lib/contourgl')
18+
]);
19+
1520
describe('Test hover and click interactions', function() {
1621

1722
if(!hasWebGLSupport('gl2d_click_test')) return;

test/jasmine/tests/gl2d_scatterplot_contour_test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ var Plotly = require('@lib/index');
44
var Lib = require('@src/lib');
55
var d3 = require('d3');
66

7-
// heatmapgl & contourgl is not part of the dist plotly.js bundle initially
7+
// contourgl is not part of the dist plotly.js bundle initially
88
Plotly.register([
9-
require('@lib/heatmapgl'),
109
require('@lib/contourgl')
1110
]);
1211

0 commit comments

Comments
 (0)