Skip to content

Commit 0e4e1d5

Browse files
authored
Merge pull request #1393 from ropensci/input-z
Heatmap z event data should derive from _z calc attribute
2 parents 741ce17 + 4fabee3 commit 0e4e1d5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

inst/htmlwidgets/plotly.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,15 @@ HTMLWidgets.widget({
243243
var gd = document.getElementById(el.id);
244244
var trace = gd.data[pt.curveNumber];
245245

246-
// Add other attributes here, if desired
246+
// Heatmap z event data should derive from _z calc attribute
247+
// https://github.com/ropensci/plotly/issues/1141
248+
var z = trace.type === "heatmap" ? "_z" : "z";
247249
if (!trace._isSimpleKey) {
248-
var attrsToAttach = ["key", "z"];
250+
var attrsToAttach = ["key", z];
249251
} else {
250252
// simple keys fire the whole key
251253
obj.key = trace.key;
252-
var attrsToAttach = ["z"];
254+
var attrsToAttach = [z];
253255
}
254256

255257
for (var i = 0; i < attrsToAttach.length; i++) {

0 commit comments

Comments
 (0)