-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Easy specification of dimensions for hover tool #1816
Comments
Not sure whether I'm convinced one way or another, but I would guess a flat syntax like 'hover+time+voltage-temperature' would be simpler to work with. |
Definitely don't like using some special syntax inside a string like that. I'd be okay with a |
What would I don't thinks |
It would enable the hover tool.
Tooltips is the right name imo, here's the definition of tooltips:
|
The key bit for me is the last point - it is normally about describing function and not giving data values. @jbednar's opinion might help us with a better suggestion and I don't mind |
|
That is a good argument for calling it |
Don't ask me; I've always thought |
I also like |
So, what was the result of this? that sintaxis proposed in the OP works? |
Sounds like we could support a general mechanism for Bokeh tools where we generalize our |
Would be great to revisit this. still a major sticking point. Especially if a user can also specify whether to include their 'label' and 'group' arg value as a hover/tooltip entry.. for instance: #3603 |
Wanted to drop some feature ideas:
tools=[{"hover": ["{index.0f}", "{x:.1f}", {"y:.1f}"]}]
tools=[{"hover": {"index": "Index", "x": "X-Coordinate"}}
tools=[{"hover": {"index": ("Index", ".0f"), "x": ("X-Coordinate", ".1f")}}
tools=[{"hover": {[
("index", "$index"),
("(x,y)", "(x=$x{0[.]00000}, y=$y{0[.]00000})"),
]}}] Questions:
|
Over time, I have become even more hesitant to support these nested structures and I think I've come to the conclusion that we should leave
I think that |
@jlstevens could you expand on why you've become l hesitant to support the nested approach? |
These nested representations are often opaque, hard to manipulate correctly and brittle (more chance for syntax errors among other things). |
Neither the nested nor the separate keywords are particularly discoverable ("how was I supposed to know there is a separate |
A nested dict is indeed hard to work with, and since most people agreed that tile_opts would be the better option in holoviz/hvplot#1299, I think I'll just start going with separate keywords like
However, I think both of these should be a list potentially? I'll have to try to get a better idea |
I propose these three new params: hover_tooltips = param.ClassSelector(class_=(str, list), default=[], doc="""
A list of strings to be displayed in the hover tooltip.
Or a list of tuples can be provided to also additionally specify the
label and value format. Lastly, a string can be provided if a custom
HTML template is provided.
""")
hover_formatters = param.List(default=[], doc="""
A list of formatting options for the hover tooltips.""")
hover_mode = param.ObjectSelector(default='mouse', objects=['mouse', 'vline', 'hline'], doc="""
The hover mode determines how the hover tool is activated.""") To not deviate too much from Bokeh, it should mirror what Bokeh has: hover_tooltips=[
( 'date', '@date{%F}' ),
( 'close', '$@{adj close}{%0.2f}' ), # use @{ } for field names with spaces
( 'volume', '@volume{0.00 a}' ),
],
hover_formatters={
'@date' : 'datetime', # use 'datetime' formatter for '@date' field
'@{adj close}' : 'printf', # use 'printf' formatter for '@{adj close}' field
# use default 'numeral' formatter for other fields
},
hover_mode='vline' I believe this will be extremely convenient for users to have it broken up like this. Previously, users would have to import and completely build the I'd like to also propose supporting a list of strings in hover_tooltips:
And potentially a list of Python string formats(?, will decide if this is easy to implement; I think yes?)
In case users don't want to specify the format. |
I like @ahuang11's suggestion: we can point to Bokeh's API and all we are doing is removing a level of nesting and an import when creating a hovertool (at least regarding the keywords and their basic functionality...we can also add some sugar if it is useful). |
I'm +1 as well. Python string formats sound nice, but in practice may not be straightforward. |
Okay I started implementing it in #6180. As I understand, there's a lot of places that rebuild HoverTool so lots more work to add, but wanted to solicit initial feedback first before continuing. A couple things added to the proposal
hover_tooltips=["x", ("Dollars", "$@{y}{0.2f}")] VS hover_tooltips=[("x", "@x"), ("Dollars", "$@{y}{0.2f}")]
Screen.Recording.2024-04-09.at.3.29.35.PM.movIn the PR above, I don't think I'll be supporting converting Python formats to Bokeh; perhaps in the future.
|
Don't much like the naming of these. For one the |
So |
I suppose semantically that makes sense although there will now be special fields defined by bokeh as well as some additional ones defined by holoviews. Not too terrible I suppose! |
Okay, I think #6180 is in a pretty good state now for review. See the new docs under The only thing missing are tests now I think. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Instead of building an explicit hover tool to choose dimensions to show hover information for, maybe we could have a syntax such as:
Where
+
means you are building a whitelist (what to include) and-
means it is a blacklist (what to exclude). E.g to exclude 'time' and 'voltage':The text was updated successfully, but these errors were encountered: