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
Tooltip doesn't support "image" key #2474
Comments
I don't think Vega-Lite supports that feature of vega-tooltip, and so Altair cannot support it either. I'd suggest reporting the issue in the Vega-Lite repository. |
I just discovered that it is possible to show rendered images in altair/vega-lite tooltips like this: import altair as alt
import pandas as pd
source = pd.DataFrame.from_records(
[{'a': 1, 'b': 1, 'image': 'https://altair-viz.github.io/_static/altair-logo-light.png'},
{'a': 2, 'b': 2, 'image': 'https://avatars.githubusercontent.com/u/11796929?s=200&v=4'}]
)
alt.Chart(source).mark_circle(size=200).encode(
x='a',
y='b',
tooltip=['image'] # Must be a list for the image to render
) I added a PR with this example in #2519 |
Sorry I missed that this was specifically about using the Although if we look at the example given for how to use the tooltips in Vega-Lite vega/vega-lite#7635 (comment), it is similar to what I have used above, so I am not sure if the 'image' key will be exposed directly in vega-lite or if this is the recommended approach to show images. @ehknight Could you confirm whether this can be closed or there is still a use case that you think is not covered? |
(Followup in case it helps anyone: to render this requires the frontend to load vega version 5.21.0 or newer) |
Reading my own comment again, the example we added cover the "image" key mechanism mentioned by the OP so once #2570 is merged with that clarification, then this can be closed. I also PRed it to the VL docs vega/vega-lite#8048 |
Yeah. This really had me going for a while. Altair could benefit from the same documentation. |
My understanding is that to render tooltips, Altair uses the
vega-tooltip
plugin. Per that project's README, one awesome feature that library has is the ability to render images as part of the tooltip with the image key. From the docs:Using the tooltip without the
image
key is fine:However, when I add the
image
key, it stops working:Maybe this feature is already supported but the schema is out of date? Thanks.
Please follow these steps to make it more efficient to solve your issue:
vega_datasets
.The text was updated successfully, but these errors were encountered: