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.

Multiple Tooltip Elements

See original GitHub issue

I am looking for a way to display multiple elements within one tooltip. I did not find a way to do this in Altair directly. In vega-lite, I would do something like

"tooltip": [
          {"type": "quantitative", "aggregate": "sum", "field": "A"},
          {"type": "quantitative", "aggregate": "sum", "field": "B"}
          ],

and it would show the sum of A and the sum of B like so:

vega_tooltip_demo

If Altair does not yet support this, I think this is a useful feature to be added in the future.

Regards, Immanuel

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jakevdpcommented, May 23, 2018

This is supported in the master branch, and will be included in the version 2.1 release. Just pass multiple field names to the tooltip encoding; e.g.

chart.encode(
    tooltip=['sum(A):Q', 'sum(B):Q']
)
2reactions
jakevdpcommented, May 25, 2018

It can also be done in version 2.0, but not as conveniently. You have to bypass the encode() method and modify the encoding directly without any shorthands; e.g.

chart = alt.Chart().encode(...) #... define the full chart + encodings first

# add multiple tooltips
chart.encoding.tooltip = [
          {"type": "quantitative", "aggregate": "sum", "field": "A"},
          {"type": "quantitative", "aggregate": "sum", "field": "B"}
]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Tooltip / How To / Create and show Tooltip on Multiple Targets
Tooltip can be created and shown on multiple targets within a container by defining the specific target elements to the target property.
Read more >
How to add one tooltip for multiple element? - Stack Overflow
In PrimeFaces, you can use a <p:tooltip /> with the attribute globalSelector ( ...
Read more >
Multiple Tooltips - Kendo UI for Vue Docs & Demos - Telerik
You can display multiple Tooltips on the same page. Depending on their position and the available area around them, the tooltips can accept...
Read more >
How to Create Custom Shape Tooltip For Multiple Datasets in ...
How to Create Custom Shape Tooltip For Multiple Datasets in Chart JSIn this ... To keep the video short we might expect you...
Read more >
Customized tooltip in Google Map Data Studio. - Danalyser
Adding Multiple Tooltip Annotations in Data (Looker) Studio Google Maps. 18 September, 2021; Sin Ling Chan. Unlike advanced BI tool like Power BI, ......
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