Vega-tooltip image support
See original GitHub issuePlease:
- Check for duplicate issues. Please file separate requests as separate issues.
I could find any duplicate issues
- Describe how to reproduce the bug.
(x-post from Altair issue here: https://github.com/altair-viz/altair/issues/2474)
My understanding is that to render tooltips, Vega-Lite and 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:
Supports special keys title (becomes the title of the tooltip) and image (used as the url for an embedded image)
However, this does not seem to be supported in Altair, because it is does not seem to be added yet to Vega-Lite. This would be a very useful feature to support.
- Use the latest versions of Vega and Vega-Lite.
- Provide an minimal, reproducible example spec in JSON, wrapped by triple backticks like this:
Works:
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.8.1.json",
"config": {
"view": {
"continuousHeight": 300,
"continuousWidth": 400
}
},
"data": {
"name": "data-724890d4e94cac4976cbd99ef3589be4"
},
"datasets": {
"data-724890d4e94cac4976cbd99ef3589be4": [
{
"a": 1.0,
"b": 1.0
}
]
},
"encoding": {
"tooltip": [
{
"field": "a",
"title": "My Cool Tooltip",
"type": "quantitative"
}
],
"x": {
"field": "a",
"type": "quantitative"
},
"y": {
"field": "b",
"type": "quantitative"
}
},
"mark": "circle",
"selection": {
"selector003": {
"bind": "scales",
"encodings": [
"x",
"y"
],
"type": "interval"
}
}
}
Does not work:
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.8.1.json",
"config": {
"view": {
"continuousHeight": 300,
"continuousWidth": 400
}
},
"data": {
"name": "data-724890d4e94cac4976cbd99ef3589be4"
},
"datasets": {
"data-724890d4e94cac4976cbd99ef3589be4": [
{
"a": 1.0,
"b": 1.0
}
]
},
"encoding": {
"tooltip": [
{
"field": "a",
"title": "My Cool Tooltip",
"type": "quantitative",
"image": "https://picsum.photos/200/300.jpg"
}
],
"x": {
"field": "a",
"type": "quantitative"
},
"y": {
"field": "b",
"type": "quantitative"
}
},
"mark": "circle",
"selection": {
"selector003": {
"bind": "scales",
"encodings": [
"x",
"y"
],
"type": "interval"
}
}
}
- If applicable, include error messages and screenshots, GIF videos (e.g. using https://www.cockos.com/licecap/), or working examples (e.g. by clicking share in the Vega-Editor or https://bit.ly/vega-lite-blocks)

Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Tooltip | Vega-Lite
To create a tooltip, Vega-Lite's tooltip channel can be mapped to a data field. For example, this bar chart supports tooltips for field...
Read more >vega-tooltip - npm
Vega Tooltip is installed in the Vega Editor. demo image. Features. Renders nice tooltips for Vega and Vega-Lite charts; Supports dark and ...
Read more >vega-tooltip | Yarn - Package Manager
A tooltip plugin for Vega-Lite and Vega visualizations. vega-lite, vega, tooltip ... Vega Tooltip is installed in the Vega Editor. demo image. Features....
Read more >Vega show field in tooltip - Stack Overflow
Vega show field in tooltip ... enter image description here ... { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", ...
Read more >Tooltips | Charts - Google Developers
You can create HTML tooltips on core charts by specifying tooltip. ... with the tooltip role. Note: this is not supported by the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Open the Chart in the Vega Editor
Thanks for looking into this @domoritz. In the meantime, are there any possible workarounds? Thanks.