Package detail

vega-tooltip

vega1mBSD-3-Clause1.0.0

A tooltip plugin for Vega-Lite and Vega visualizations.

vega-lite, vega, tooltip

readme

Tooltip for Vega & Vega-Lite

npm version Build Status codecov code style: prettier

A tooltip plugin for Vega and Vega-Lite visualizations. This plugin implements a custom tooltip handler for Vega that uses custom HTML tooltips instead of the HTML title attribute. Vega Tooltip is installed in the Vega Editor.

demo image

Features

  • Renders nice tooltips for Vega and Vega-Lite charts
  • Supports dark and light theme
  • Renders object-valued tooltips as a table
  • Supports special keys title (becomes the title of the tooltip) and image (used as the url for an embedded image)

Demo

http://vega.github.io/vega-tooltip/

Installing

We recommend using Vega-Embed, which already comes with this tooltip plugin.

You can install Vega tooltip directly with npm install vega-tooltip.

Using Vega-tooltip with a CDN

You can import vega-tooltip directly from jsDelivr. Replace [VERSION] with the version that you want to use.

<!-- Import Vega 5 & Vega-Lite 4 (does not have to be from CDN) -->
<script src="https://cdn.jsdelivr.net/npm/vega@5"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@4"></script>

<script src="https://cdn.jsdelivr.net/npm/vega-tooltip@[VERSION]"></script>

Usage and APIs

If you use Vega-Embed, you don't need to install Vega Tooltip! Vega Embed already comes with Vega Tooltip. You can however pass tooltip customizations.

vegaEmbed("#vis", spec, {tooltip: {theme: 'dark'}})
  .then(function(result) {
    // result.view contains the Vega view
  })
  .catch(console.error);

If you want to use a different version of the tooltip handler, you can override the default handler with the handler from Vega Tooltip (and you need to install it separately).

var handler = new vegaTooltip.Handler();
vegaEmbed("#vis", spec, {tooltip: handler.call})
  .then(function(result) {
    // result.view contains the Vega view
  })
  .catch(console.error);

See the API documentation for details.

Tutorials

  1. Creating Your Tooltip
  2. Customizing Your Tooltip

Run Instructions

  1. In the project folder vega-tooltip, type command npm i to install dependencies.
  2. Then, type npm run start. This will build the library and start a web server.
  3. In your browser, navigate to http://localhost:8000/, where you can see various Vega-Lite and Vega visualizations with tooltip interaction.

Publishing

To make a release, run npm run release. The update the website with npm run deploy:gh.

changelog

0.35.2 (2024-11-16)

Bug Fixes

  • mark position calculation when only x or y are defined (#974) (795bd70)

0.35.1 (2024-11-05)

Bug Fixes

0.35.0 (2024-11-05)

Features

  • anchor tooltip to mark (#959) (5a95192)
  • move to npm, update rollup typescript, remove need for rsync (#970) (77e5732)

0.34.0 (2023-12-18)

Features

0.33.0 (2023-08-07)

Features

  • remove : from default format string to enable easier customization and localization (bab8e2a), closes #785

0.32.0 (2023-04-20)

Features

0.31.0 (2023-02-22)

Features

  • remove limit on image size in tooltips (#740) (ca90788)

0.30.1 (2023-02-13)

  • chore: switch to release-it (45e1520)
  • chore: update lockfile (778a85d)
  • chore: upgrade deps (e756faf)
  • chore(deps-dev): bump @rollup/plugin-json from 5.0.1 to 5.0.2 (#721) (3610e13), closes #721
  • chore(deps-dev): bump @rollup/plugin-json from 5.0.2 to 6.0.0 (2cae3b7)
  • chore(deps-dev): bump browser-sync from 2.27.10 to 2.27.11 (#727) (f58fbdb), closes #727
  • chore(deps-dev): bump concurrently from 7.5.0 to 7.6.0 (#722) (14d5d94), closes #722
  • chore(deps-dev): bump gh-pages from 4.0.0 to 5.0.0 (26545d9)
  • chore(deps-dev): bump jest-environment-jsdom from 29.3.1 to 29.4.1 (#732) (07651aa), closes #732
  • chore(deps-dev): bump rollup from 3.3.0 to 3.5.1 (#720) (b80e8ab), closes #720
  • chore(deps-dev): bump rollup from 3.5.1 to 3.9.0 (#725) (c6f4a02), closes #725
  • chore(deps-dev): bump rollup from 3.9.0 to 3.12.1 (#733) (92d6691), closes #733
  • chore(deps-dev): bump sass from 1.56.1 to 1.57.1 (#726) (97fdb99), closes #726
  • chore(deps-dev): bump sass from 1.57.1 to 1.58.0 (#730) (b50d170), closes #730
  • chore(deps-dev): bump typescript from 4.9.3 to 4.9.4 (#724) (7f0376e), closes #724
  • chore(deps-dev): bump typescript from 4.9.4 to 4.9.5 (#729) (41fcca9), closes #729
  • chore(deps): bump engine.io from 6.2.0 to 6.2.1 (#719) (e55c3a9), closes #719
  • chore(deps): bump json5 from 2.2.1 to 2.2.3 (#728) (6d94b88), closes #728

v0.29.0 (Fri Nov 18 2022)

:tada: This release contains work from new contributors! :tada:

Thanks for all your work!

:heart: Maya Barnes (@mayagbarnes)

:heart: Stefan van der Meer (@svdm)

🚀 Enhancement

🐛 Bug Fix

🔩 Dependency Updates

Authors: 4


v0.28.0 (Fri Jan 28 2022)

:tada: This release contains work from new contributors! :tada:

Thanks for all your work!

:heart: Stefan van der Meer (@svdm)

:heart: Cameron Yick (@hydrosquall)

🚀 Enhancement

🐛 Bug Fix

🔩 Dependency Updates

Authors: 4


v0.4.0 (Wed Jul 28 2021)

:tada: This release contains work from new contributors! :tada:

Thanks for all your work!

:heart: Cameron Yick (@hydrosquall)

:heart: Abe Rubenstein (@sighrobot)

:heart: siddhant (@siddhant1)

:heart: null@melissachang

:heart: Noon van der Silk (@silky)

:heart: Ken Lin (@kenklin)

:heart: Yash Dev Lamba (@ydlamba)

:heart: Yuri Astrakhan (@nyurik)

:heart: Jeffrey Heer (@jheer)

:heart: Eric Socolofsky (@ericsoco)

:heart: Robin Millette (@millette)

🚀 Enhancement

  • feat: add option formatTooltip and use formatValue as default #557 (@sighrobot)
  • feat: externalize vega util for smaller builds (@domoritz)
  • feat: support images in tooltips #389 (@domoritz)

🐛 Bug Fix

⚠️ Pushed to stable

🔩 Dependency Updates

Authors: 19