🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

d3-tip-2021

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-tip-2021

Tooltips for d3 svg visualizations

latest
Source
npmnpm
Version
0.10.1
Version published
Maintainers
1
Created
Source

d3.tip: Tooltips for d3.js visualizations

This fork fixes 2 long standing issues with the original (now archived) d3-tip:

  • The rootElement configuration had a bug which meant it couldn't be used.

  • Using the rootElement config would cause the tooltips to display in the wrong place (even completely off the screen) when it was inside a scrollable ancestor or any ancestor with position: relative.

  • See a live demo (of the original fork)

  • Example code

API Docs

See the API Documentation

Download Latest Version

Install with NPM

npm install d3-tip-2021

Quick Usage

/* Initialize tooltip */
tip = d3.tip().attr('class', 'd3-tip').html(function(d) { return d; });

/* Invoke the tip in the context of your visualization */
vis.call(tip)

vis.selectAll('rect')
  .data(data)
  .enter()
  .append('rect')
  .attr('width', function() { return x.rangeBand() })
  .attr('height', function(d) { return h - y(d) })
  .attr('y', function(d) { return y(d) })
  .attr('x', function(d, i) { return x(i) })
  .on('mouseover', tip.show)
  .on('mouseout', tip.hide)

If you want basic styling, you can include example-styles.css using a service like rawgithub.com.

<link rel="stylesheet" href="//rawgithub.com/Caged/d3-tip/master/examples/example-styles.css">

Keywords

d3

FAQs

Package last updated on 31 Jan 2022

Did you know?

Socket

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.

Install

Related posts