-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Hide hover and spike modebar buttons in plotly.js v2 by default and add config options to bring them back in #5654
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b19d960
drop hover and spike modebars
archmoj 992352b
add hover and spike modes to extra modes that could be enabled
archmoj f7d5a3a
adjust tests
archmoj 74649d0
enable hover modebars using simplified strings
archmoj 3602a51
use lowercase for exposed hover button names
archmoj cd6c5a1
bring back and adjust two noHover tests
archmoj 2d4bc78
accept uppercase and camelCase strings modebar button strings
archmoj f4e6120
add v1hovermode option
archmoj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
So what you're saying is, we still calculate the hover entries you would have gotten, back in 1.x when we included them by default, and in 2.x you won't get them by default but you'll be allowed to re-include any of those exact buttons but no others.
I guess it makes sense to restrict to only the buttons we know will work, but as a user it may be hard to figure out what those buttons are in any given case. For example Sankey gets
['hoverClosestCartesian', 'hoverCompareCartesian']
? And some multi-type plots just get['toggleHover']
but others get something more specific?What if we accept a special
buttonsToAdd
value'hovermode'
, that copies all ofhoverGroup
intoenabledHoverGroup
- ie to get back 1.x behavior no matter what traces you have you can just use that one special value?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.
this sounds like a good solution to me.
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.
maybe
v1hovermode
or something to clearly identify this as "the v1 behaviour" ?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.
Exactly.
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.
It is doable but at the same time rather confusing (and perhaps hard to maintain) as the v1
hoverGroup
does includespike
options too. Plus in that case we may restrict users to only include all of those buttons but not some?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.
Right, if you want some subset of the v1 behavior you have to figure out the specific options you need and specify them explicitly.
Good point re: spikes.
'togglespikelines'
is pretty simple and easy to document; so let's have'v1hovermode'
give you just the hovermode buttons - ie everything inhoverGroup
excepttoggleSpikelines
if it's there.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.
OK.
How about
allhovermodes
instead ofv1hovermode
?Later on the road we may want to add extra buttons e.g. for
unified hover
options and havingv1
would make it difficult to add those.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.
If we call it
allhovermodes
it's wrong until we add unified. And unified is more a decision chart developers will make, whereas compare vs closest has times it's useful to viewers (mainly for charts that the developer didn't explicitly specify the best hovermode) so I don't see much need to add a button for unified.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.
Yes. I would favour
v1hovermodes
as it's clear that this is simply brining back the old mode without making any additional promises/implying anything else about "all" anything :)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.
Added in f4e6120.