-
-
Notifications
You must be signed in to change notification settings - Fork 2k
disable hover for sankey traces when hovermode is false #2949
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 2 commits
edc20b0
45f06c4
98c18f8
aafa886
3d32b6f
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 |
|---|---|---|
|
|
@@ -482,6 +482,28 @@ describe('sankey tests', function() { | |
| .catch(failTest) | ||
| .then(done); | ||
| }); | ||
|
|
||
| it('should not show labels if hovermode is false', function(done) { | ||
| var gd = createGraphDiv(); | ||
| var mockCopy = Lib.extendDeep({}, mock); | ||
|
|
||
| function _hover(px, py) { | ||
| mouseEvent('mousemove', px, py); | ||
| mouseEvent('mouseover', px, py); | ||
| Lib.clearThrottle(); | ||
| } | ||
|
Collaborator
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. Can we push this to an outer scope so we're not just repeating the function from above?
Collaborator
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. heh I see, it was already duplicated - great, we can clean them all up into just one |
||
|
|
||
| Plotly.plot(gd, mockCopy).then(function() { | ||
| return Plotly.relayout(gd, 'hovermode', false); | ||
| }) | ||
| .then(function() { | ||
| _hover(404, 302); | ||
|
|
||
| assertNoLabel(); | ||
| }) | ||
| .catch(failTest) | ||
| .then(done); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Test hover/click event data:', function() { | ||
|
|
@@ -620,3 +642,8 @@ function assertLabel(content, style) { | |
| fontColor: style[4] | ||
| }); | ||
| } | ||
|
|
||
| function assertNoLabel() { | ||
| var g = d3.selectAll('.hovertext'); | ||
| expect(g[0].length).toBe(0); | ||
|
Collaborator
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.
Contributor
Author
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. Good point! |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to bail out of the
unhoverhandlers as well, to ensure that we don't emitplotly_unhoverevents? Or does this already avoid these events?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcjohnson It was indeed emitting a bunch of
plotly_unhoverevents. It is fixed in my next commit.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! I guess then we should 🔒 the events too, by adding a
hovermode: falsecase to the click/hover events test