By adding transitions, we can more easily follow the elements as they are entered, updated and exited. Separate transitions are defined for each of the three states. To avoid repeating transition timing parameters for the enter, update, and exit selections, a top-level transition t sets the duration, and then subsequent transitions use selection.transition, passing in t to inherit timing:
var t = d3.transition()
.duration(750);
Want to read more? Try these tutorials:
See the D3 wiki for even more resources.
Previous: Key Functions
forked from mbostock's block: General Update Pattern, III
forked from anonymous's block: General Update Pattern, III
https://d3js.org/d3.v4.min.js