-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add hoverongaps to heatmap and contour for suppressing hovers on missing data #4291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0a4feb3
dd3cfaf
fbaf636
9269352
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,28 +88,14 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay | |
} | ||
} | ||
|
||
var zVal = z[ny][nx]; | ||
if(zmask && !zmask[ny][nx]) zVal = undefined; | ||
|
||
var text; | ||
if(Array.isArray(cd0.hovertext) && Array.isArray(cd0.hovertext[ny])) { | ||
text = cd0.hovertext[ny][nx]; | ||
} else if(Array.isArray(cd0.text) && Array.isArray(cd0.text[ny])) { | ||
text = cd0.text[ny][nx]; | ||
} | ||
|
||
// dummy axis for formatting the z value | ||
var cOpts = extractOpts(trace); | ||
var dummyAx = { | ||
type: 'linear', | ||
range: [cOpts.min, cOpts.max], | ||
hoverformat: zhoverformat, | ||
_separators: xa._separators, | ||
_numFormat: xa._numFormat | ||
}; | ||
var zLabel = Axes.tickText(dummyAx, zVal, 'hover').text; | ||
|
||
return [Lib.extendFlat(pointData, { | ||
var obj = { | ||
index: [ny, nx], | ||
// never let a 2D override 1D type as closest point | ||
distance: pointData.maxHoverDistance, | ||
|
@@ -120,8 +106,26 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay | |
y1: y1, | ||
xLabelVal: xl, | ||
yLabelVal: yl, | ||
zLabelVal: zVal, | ||
zLabel: zLabel, | ||
text: text | ||
})]; | ||
}; | ||
|
||
var zVal = z[ny][nx]; | ||
if(zmask && !zmask[ny][nx]) zVal = undefined; | ||
|
||
if(zVal !== undefined || trace.hovergaps) { | ||
// dummy axis for formatting the z value | ||
var cOpts = extractOpts(trace); | ||
var dummyAx = { | ||
type: 'linear', | ||
range: [cOpts.min, cOpts.max], | ||
hoverformat: zhoverformat, | ||
_separators: xa._separators, | ||
_numFormat: xa._numFormat | ||
}; | ||
|
||
obj.zLabelVal = zVal; | ||
obj.zLabel = Axes.tickText(dummyAx, zVal, 'hover').text; | ||
} | ||
|
||
return [Lib.extendFlat(pointData, obj)]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this mean when Does this mean that the hover label is suppressed, but the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is a codepen displaying the current behaviour with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fantastic!! |
||
}; |
Uh oh!
There was an error while loading. Please reload this page.