Selections and joins
As D3 is a declarative framework, there is no
d3.create (at least that I know of) for creating SVG elements. Instead, you would use a
.selectAll() with the selector matching the type of element you want to create, followed by
.data(), to bind the data to that selector. At that point, you can call
.enter() to create the svg elements. The benefit of this approach is that you also have the
.join() method. This will, in addition to what
.enter() would do, also remove SVG elements that do not have corresponding entries in the data and update the entries whose data has changed.