-
-
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
unified hover label #4620
unified hover label #4620
Conversation
otherwise console logs errors for mock "box-alignment-offset"
Great PR! |
Very cool! @antoinerg have you tested We may not need to handle unified hover labels + MathJax for the first iteration, but it would be nice to confirm |
|
||
if(!fullLayout._infolayer || !gd.calcdata) return; | ||
// Check whether this is the main legend (ie. called without any opts) |
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 is little hacky.
What if we pass proper options to draw legend.
In that case one may look into opts._main
to figure out the mocked legend (for unified hover) from the actual legend.
Hover is not showing up on this mock | possibly related to not having enough space? |
@etpinard I just tested it and you were right that |
That's good.
I agree 100% cc #3841 |
…pported without this fix, in mock "ohlc_first", the library tries to render MathJax and the result is broken
This is addressed in ec8c373 which is a big improvement. The second, third and fourth mocks in https://codepen.io/antoinerg/pen/MWwpPpa are now much better. |
Wow! Hover on those mocks look very nice. Here is the updated demo. |
Just watching @nicolaskruchten demo this and saying "I have to reload because there’s no button for unified hover" - makes me think perhaps unified vs separate hover should be a new layout attribute ( |
@@ -61,6 +61,16 @@ module.exports = { | |||
editType: 'modebar', | |||
description: [ | |||
'Determines the mode of hover interactions.', | |||
'If `closest`, a single hoverlabel will appear', |
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.
Please put flags between two * and attributes between ` chars.
E.g. this line should be
'If *closest*, a single `hoverlabel` will appear',
That's an interesting idea. Either this or we add a third button? cc @nicolaskruchten |
We don't want to add a new attribute because there's no real meaning to unified + closest. I also don't really want to add a new button today because the mode bar is already pretty big IMO. Maybe in unified hover mode the two existing buttons disappear by default? |
By itself that's true, but it serves the purpose of saving the fact that you when you enable compare mode you want it to have unified hover. |
This could be achieved in 2 lines of code. |
I kinda like having |
I'd be OK with, as a short-term measure, removing the hover mode buttons in one of the unified modes. Perhaps down the line this is just one more reason to put some menus into the mode bar - one for hovermode, another for drag mode... |
I remove the modebar buttons when hovermode is
I can open an issue for this one if you'd like! |
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.
💃 Beautiful!
Indeed, the Regarding Plotly Express, yes, in the docs here https://plotly.com/python/hover-text-and-formatting/ we recommend forcing |
@antoinerg This looks awesome. Thank you. When there are many traces the information gets hidden. Any hint or suggestion to have the legend with scroll or above the graph? |
Thanks @jcunhafonte - moved to a new issue #4786 |
Closes #4477 by introducing hover modes
x unified
andy unified
!Codepen:
TODO:
(marker | line).color
(ec8c373)legend_horizontal_autowrap
(fixed in ae5b9cc)