question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vega-tooltip image support

See original GitHub issue

Please:

  • 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.

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"
    }
  }
}
Screen Shot 2021-08-03 at 10 33 16 AM

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
domoritzcommented, Sep 23, 2021
{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "description": "A simple bar chart with embedded data.",
  "data": {
    "values": [
        {"image": "data/ffox.png"},
        {"image": "data/gimp.png"},
        {"image": "data/7zip.png"}
      ]
  },
  "mark": {"type": "text", "tooltip": true},
  "encoding": {
    "text": {"field": "image"},
    "y": {"field": "image", "axis": null}
  }
}

Open the Chart in the Vega Editor

Screen Shot 2021-09-23 at 10 55 20
0reactions
ehknightcommented, Aug 13, 2021

Thanks for looking into this @domoritz. In the meantime, are there any possible workarounds? Thanks.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found