Skip to content

Commit

Permalink
Merge pull request #1884 from plotly/heatmapgl-hover-fix
Browse files Browse the repository at this point in the history
Fix heatmapgl point number event data
  • Loading branch information
etpinard committed Jul 17, 2017
2 parents 700c088 + a6acd15 commit 9948af4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/traces/contourgl/convert.js
Expand Up @@ -77,7 +77,7 @@ proto.handlePick = function(pickResult) {
],
textLabel: this.textLabels[index],
name: this.name,
pointIndex: [xIndex, yIndex],
pointIndex: [yIndex, xIndex],
hoverinfo: this.hoverinfo
};
};
Expand Down
2 changes: 1 addition & 1 deletion src/traces/heatmapgl/convert.js
Expand Up @@ -63,7 +63,7 @@ proto.handlePick = function(pickResult) {
],
textLabel: this.textLabels[index],
name: this.name,
pointIndex: [xIndex, yIndex],
pointIndex: [yIndex, xIndex],
hoverinfo: this.hoverinfo
};
};
Expand Down
33 changes: 33 additions & 0 deletions test/jasmine/tests/gl2d_click_test.js
Expand Up @@ -326,6 +326,39 @@ describe('Test hover and click interactions', function() {
.then(done);
});

it('should output correct event data for heatmapgl (asymmetric case) ', function(done) {
var _mock = {
data: [{
type: 'heatmapgl',
z: [[1, 2, 0], [2, 3, 1]],
text: [['a', 'b', 'c'], ['D', 'E', 'F']],
hoverlabel: {
bgcolor: [['red', 'blue', 'green'], ['cyan', 'pink', 'black']]
}
}]
};

var run = makeRunner([540, 150], {
x: 2,
y: 1,
curveNumber: 0,
pointNumber: [1, 2],
bgColor: 'rgb(0, 0, 0)',
borderColor: 'rgb(255, 255, 255)',
fontSize: 13,
fontFamily: 'Arial',
fontColor: 'rgb(255, 255, 255)'
}, {
noUnHover: true,
msg: 'heatmapgl'
});

Plotly.plot(gd, _mock)
.then(run)
.catch(fail)
.then(done);
});

it('should output correct event data for scattergl after visibility restyle', function(done) {
var _mock = Lib.extendDeep({}, mock4);

Expand Down

0 comments on commit 9948af4

Please sign in to comment.