-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Set unified hovermode via template #4669
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2c76d79
enable unified hovermode via template
archmoj 3c883ff
refactor check for unified hover modes
archmoj 9c07a91
make a similar function in helpers to test x or y hover modes
archmoj 11a4e27
make a separate function to coerce clickmode and hovermode
archmoj 3c47bf9
use coerce hovermode in cartesian defaults
archmoj dc704ae
move hovermode coerce outside the loop
archmoj abf3a55
improve test for spikelines
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 hidden or 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 hidden or 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
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.
Does it not work with just
layoutOut.hovermode
? Do we need thelayoutIn
fallback for some specific case?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.
Some tests failed without the
layoutIn
fall back.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 this is just unit tests (ie we're not running the entire
supplyDefaults
pipeline so earlier steps in that should have setlayoutOut.hovermode
were not called, then I'd rather change the test than include this fallback. If there's a case where the full pipeline does not behave correctly then this worries me, as that case presumably would not work with templates.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.
hovermode
coerce with auto defaults depending oncartesian
isplotly.js/src/components/fx/layout_defaults.js
Lines 36 to 44 in 6de4c75
called at the end of pipeline here:
plotly.js/src/plots/plots.js
Lines 1672 to 1678 in 6de4c75
I am not sure how to proceed if we want to remove
layoutIn.hovermode
fallback.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.
On another note - here is test which is failing, if we remove
layoutIn
fallback:plotly.js/test/jasmine/tests/hover_label_test.js
Lines 4037 to 4052 in 6de4c75
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 that test is failing without the
layoutIn
fallback, it means that spikes will not be properly enabled byhovermode
set in thetemplate
, right?So I guess the code here is called by the
basePlotModules
loop:plotly.js/src/plots/plots.js
Lines 1639 to 1647 in 6de4c75
I think the easiest thing to do would be to move
hovermode
coercion here, right at the top of this function. That will involve making a specialcoerce
function usingfx/layout_attributes
, but it will ensure the ordering is correct.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 Good call. Revised in the commits below.