Skip to content

Instantly share code, notes, and snippets.

@domoritz
Last active September 28, 2020 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save domoritz/df49a365a9555438dcfc945103c9f26e to your computer and use it in GitHub Desktop.
Save domoritz/df49a365a9555438dcfc945103c9f26e to your computer and use it in GitHub Desktop.
Vega tooltip with images
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"padding": 5,
"height": 100,
"data": [
{
"name": "data",
"values": [
{"img": "data/ffox.png"},
{"img": "data/gimp.png"},
{"img": "data/7zip.png"}
]
}
],
"marks": [
{
"name": "marks",
"type": "text",
"style": ["text"],
"from": {"data": "data"},
"encode": {
"update": {
"y": {"scale": "y", "field": "img"},
"text": {"field": "img"},
"tooltip": {
"signal": "{title: datum.img, image: datum.img}"
}
}
}
}
],
"scales": [
{
"name": "y",
"type": "point",
"domain": {"data": "data", "field": "img", "sort": true},
"range": [0, {"signal": "height"}]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment