Skip to content

Commit 9948af4

Browse files
authored
Merge pull request #1884 from plotly/heatmapgl-hover-fix
Fix heatmapgl point number event data
2 parents 700c088 + a6acd15 commit 9948af4

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

src/traces/contourgl/convert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ proto.handlePick = function(pickResult) {
7777
],
7878
textLabel: this.textLabels[index],
7979
name: this.name,
80-
pointIndex: [xIndex, yIndex],
80+
pointIndex: [yIndex, xIndex],
8181
hoverinfo: this.hoverinfo
8282
};
8383
};

src/traces/heatmapgl/convert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ proto.handlePick = function(pickResult) {
6363
],
6464
textLabel: this.textLabels[index],
6565
name: this.name,
66-
pointIndex: [xIndex, yIndex],
66+
pointIndex: [yIndex, xIndex],
6767
hoverinfo: this.hoverinfo
6868
};
6969
};

test/jasmine/tests/gl2d_click_test.js

+33
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,39 @@ describe('Test hover and click interactions', function() {
326326
.then(done);
327327
});
328328

329+
it('should output correct event data for heatmapgl (asymmetric case) ', function(done) {
330+
var _mock = {
331+
data: [{
332+
type: 'heatmapgl',
333+
z: [[1, 2, 0], [2, 3, 1]],
334+
text: [['a', 'b', 'c'], ['D', 'E', 'F']],
335+
hoverlabel: {
336+
bgcolor: [['red', 'blue', 'green'], ['cyan', 'pink', 'black']]
337+
}
338+
}]
339+
};
340+
341+
var run = makeRunner([540, 150], {
342+
x: 2,
343+
y: 1,
344+
curveNumber: 0,
345+
pointNumber: [1, 2],
346+
bgColor: 'rgb(0, 0, 0)',
347+
borderColor: 'rgb(255, 255, 255)',
348+
fontSize: 13,
349+
fontFamily: 'Arial',
350+
fontColor: 'rgb(255, 255, 255)'
351+
}, {
352+
noUnHover: true,
353+
msg: 'heatmapgl'
354+
});
355+
356+
Plotly.plot(gd, _mock)
357+
.then(run)
358+
.catch(fail)
359+
.then(done);
360+
});
361+
329362
it('should output correct event data for scattergl after visibility restyle', function(done) {
330363
var _mock = Lib.extendDeep({}, mock4);
331364

0 commit comments

Comments
 (0)