D3's enter and exit

As I mentioned in the last section, I want to take a quick, simplified look at enter and the associated method, exit. These methods are important for dealing with dynamic datasets. With these methods, you can take an arbitrary selection, blend it with data and then manipulate it with D3's tools to craft visualizations.

In this section, you'll see three examples. The first shows an example of using enter that illustrates calling the method against a completely empty selection. The second illustrates calling enter on a selection with existing elements. The third illustrates how exit works. 

In this first example, we select the #target element and then call selectAll with p as the argument. Since there are no paragraphs ...

Get Mastering SVG now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.