Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ec277a3

Browse files
committed
pass calc'ed text to heatmap calcdata item
- and use that to determine the text label on hover - in the case of XYZ column traces calc'3d has a different structure then fullData text, so it becomes important to use calc'ed text to hover text to work after non-do-calc interaction (e.g. zoom).
1 parent 2533f04 commit ec277a3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/traces/heatmap/calc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ module.exports = function calc(gd, trace) {
121121
Axes.expand(ya, yArray);
122122
}
123123

124-
var cd0 = {x: xArray, y: yArray, z: z};
124+
var cd0 = {x: xArray, y: yArray, z: z, text: trace.text};
125125

126126
// auto-z and autocolorscale if applicable
127127
colorscaleCalc(trace, z, '', 'z');

src/traces/heatmap/hover.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour)
9696
if(zmask && !zmask[ny][nx]) zVal = undefined;
9797

9898
var text;
99-
if(Array.isArray(trace.text) && Array.isArray(trace.text[ny])) {
100-
text = trace.text[ny][nx];
99+
if(Array.isArray(cd0.text) && Array.isArray(cd0.text[ny])) {
100+
text = cd0.text[ny][nx];
101101
}
102102

103103
return [Lib.extendFlat(pointData, {

0 commit comments

Comments
 (0)