
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
vega-tooltip
Advanced tools
The vega-tooltip npm package provides a way to add customizable tooltips to Vega and Vega-Lite visualizations. It enhances the interactivity of visualizations by displaying additional information when users hover over data points.
Basic Tooltip
This feature allows you to add a basic tooltip to a Vega or Vega-Lite visualization. The tooltip displays information about the data point that the user is hovering over.
const vegaTooltip = require('vega-tooltip');
const view = new vega.View(vega.parse(spec))
.renderer('canvas')
.initialize('#view')
.hover()
.run();
vegaTooltip.vega(view);
Custom Tooltip Content
This feature allows you to customize the content of the tooltip. You can format the tooltip content in any way you like by providing a custom format function.
const vegaTooltip = require('vega-tooltip');
const handler = new vegaTooltip.Handler({
formatType: 'custom',
format: (value) => `Custom content: ${value}`
});
const view = new vega.View(vega.parse(spec))
.renderer('canvas')
.initialize('#view')
.hover()
.run();
vegaTooltip.vega(view, handler);
Styling Tooltips
This feature allows you to style the tooltips by specifying a theme. The example shows how to apply a dark theme to the tooltips.
const vegaTooltip = require('vega-tooltip');
const handler = new vegaTooltip.Handler({
theme: 'dark'
});
const view = new vega.View(vega.parse(spec))
.renderer('canvas')
.initialize('#view')
.hover()
.run();
vegaTooltip.vega(view, handler);
d3-tip is a tool for creating tooltips in D3.js visualizations. It provides similar functionality to vega-tooltip but is specifically designed for use with D3.js. It allows for customizable and styled tooltips, but requires more manual setup compared to vega-tooltip.
tippy.js is a highly customizable tooltip and popover library. While it is not specifically designed for data visualizations, it can be used to create tooltips for any HTML element, including those in visualizations. It offers more flexibility and customization options compared to vega-tooltip.
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.
Features
title
(becomes the title of the tooltip) and image
(used as the url for an embedded image)http://vega.github.io/vega-tooltip/
We recommend using Vega-Embed, which already comes with this tooltip plugin.
You can install Vega tooltip directly with npm install vega-tooltip
.
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>
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.
vega-tooltip
, type command npm i
to install dependencies.npm run start
. This will build the library and start a web server.http://localhost:8000/
, where you can see various Vega-Lite and Vega visualizations with tooltip interaction.To make a release, run npm run release
. The update the website with npm run deploy:gh
.
FAQs
A tooltip plugin for Vega-Lite and Vega visualizations.
The npm package vega-tooltip receives a total of 198,122 weekly downloads. As such, vega-tooltip popularity was classified as popular.
We found that vega-tooltip demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.