Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

Latest commit

 

History

History
40 lines (30 loc) · 753 Bytes

showing-and-hiding-tooltips.md

File metadata and controls

40 lines (30 loc) · 753 Bytes

API Documentation ➤ Showing and hiding tooltips

Showing and hiding tooltips

tip.show

Show a tooltip on the screen.

rect.on('mouseover', tip.show)
rect.on('mouseover', function(d, i) {
  tip.show(d, i)
})

Explicit targets

Sometimes you need to manually specify a target to act on. For instance, maybe you want the tooltip to appear over a different element than the one that triggered a mouseover event. You can specify an explicit target by passing an SVGElement as the last argument.

tip.show(data, target)

tip.hide

Hide a tooltip

rect.on('mouseout', tip.hide)
rect.on('mouseout', function(d) {
  tip.hide(d)
})