-
Notifications
You must be signed in to change notification settings - Fork 794
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
[Question] Creating tooltips based on selection #2393
Comments
I don't know of any way to change the tooltip fields based on a selection. |
Ah that’s too bad! Do you know of another method to achieve something equivalent? Basically the tooltip could become a bit busy if there are many different series. |
Text label could be a solution in this case. Here is an example |
@jakevdp Do you mind if I make a PR to add this feature? Basically we want to filter out/hide zero/null values in the tooltip and possibly sort the tooltip by values. Could you give some pointers? |
@sfc-gh-cheliu That feature would need to be contributed upstream to either the https://github.com/vega/vega-lite or https://github.com/vega/vega-tooltip repo. Feel free to open an issue there with your suggestion. I'm going to close this as there is nothign to do on the altair side of things |
@joelostblom Thanks for the info. Just to double confirm, there's no way to modify altair to achieve this feature? I saw that there's a list of Tooltip objects specifying the fields/column names, can we modify some underlying logic so that if a field has zero or null value, don't let it appear in the tooltip? Or we need to modify https://github.com/vega/vega-lite instead? |
It's possible that you could make that modification in Altair, but to me it sounds like this is a better fit for an upstream contribution to Vega-Lite. We generally want fixes like this to be implemented in vega-lite directly, but I'm not familiar enough with the Tooltip code itself to know if there is any special reason to do this in altair instead |
@jakevdp @joelostblom I found that class Tooltip has a parameter called 'condition' and that might potentially satisfy the need of hiding zero/null values. However, when I try to specify it, I got a Also, if contributing to the upstream repo, which one is the best/do you recommend? https://github.com/vega/vega-lite/blob/4ba3b93e575df97ffe56713287b40d6c55b18340/src/compile/mark/encode/tooltip.ts in vega-lite or https://github.com/vega/vega-tooltip/blob/5f805fb8a6e76e3e58d2541e51b6106bcc133f11/src/Handler.ts in vega-tooltip? Thanks! |
I am not sure what is going on there, could you post a reproducible example as a new issue? You can base it off https://altair-viz.github.io/gallery/scatter_tooltips.html |
@joelostblom For the feature I want to add I've opened a new issue there. |
Thanks @sfc-gh-cheliu , Could you open a new issue in the altair repo regarding the tooltip not working with the condition although the docs say that it should? Your repro is good, we just need to track it in a separate issue. I am not sure how much I can help on the Vega-Lite side of things, so let's see what reply you issue there gets from the core vega-lite developers. |
Sure, I've opened a new issue for you to track here #3196. Thanks. |
Thanks for your great work on Altair!
I have a question on how to create tooltips that depends on the selection in the legend. I modified the pivot transform example in the documentation and currently have this:
Result in Vega-lite editor
How could I make it so the tooltip displayed only shows those series which are currently active in the legend? Is this possible?
(I saw the related issue vega/vega-lite#1552, but the answer there doesn't seem to be directly applicable. (Not sure?))
Thanks!
The text was updated successfully, but these errors were encountered: