holtzy / D3-graph-gallery

A collection of simple graphics made with D3.js
https://www.d3-graph-gallery.com
MIT License
790 stars 237 forks source link

Use transition correctly #39

Closed fkellner closed 3 years ago

fkellner commented 3 years ago

Only changing html is not eligible for a transition, the rest is.

If you wanted to specify the transition first, it would go like this:

const trans = tooltip
  .transition()
  .duration(200);
tooltip
  .transition(trans)
  .style('opacity', 1)

(and so forth). Source: https://github.com/d3/d3-transition/blob/v2.0.0/README.md#selection_transition

holtzy commented 3 years ago

Thanks!