From c5c9a1e0aa505b204e5c3cde57e129b378706b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Etienne=20T=C3=A9treault-Pinard?= <etienne@plot.ly> Date: Fri, 14 Jul 2017 17:02:53 -0400 Subject: [PATCH 1/2] fix heatmapgl point number event data - so that z[ny][nx] where ny = pointNumber[1] and nx = pointNumber[0] --- src/traces/heatmapgl/convert.js | 2 +- test/jasmine/tests/gl2d_click_test.js | 33 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/traces/heatmapgl/convert.js b/src/traces/heatmapgl/convert.js index fbac9353f3e..b661670a2d1 100644 --- a/src/traces/heatmapgl/convert.js +++ b/src/traces/heatmapgl/convert.js @@ -63,7 +63,7 @@ proto.handlePick = function(pickResult) { ], textLabel: this.textLabels[index], name: this.name, - pointIndex: [xIndex, yIndex], + pointIndex: [yIndex, xIndex], hoverinfo: this.hoverinfo }; }; diff --git a/test/jasmine/tests/gl2d_click_test.js b/test/jasmine/tests/gl2d_click_test.js index ddd576d5ab4..c3c8035b184 100644 --- a/test/jasmine/tests/gl2d_click_test.js +++ b/test/jasmine/tests/gl2d_click_test.js @@ -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); From a6acd15d52315ddce87a08b9a90970d419f76526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Etienne=20T=C3=A9treault-Pinard?= <etienne@plot.ly> Date: Fri, 14 Jul 2017 17:23:59 -0400 Subject: [PATCH 2/2] fix contourgl pointNumber event data --- src/traces/contourgl/convert.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/traces/contourgl/convert.js b/src/traces/contourgl/convert.js index 182ec900b7f..4826783ca46 100644 --- a/src/traces/contourgl/convert.js +++ b/src/traces/contourgl/convert.js @@ -77,7 +77,7 @@ proto.handlePick = function(pickResult) { ], textLabel: this.textLabels[index], name: this.name, - pointIndex: [xIndex, yIndex], + pointIndex: [yIndex, xIndex], hoverinfo: this.hoverinfo }; };