6.5 Understanding the selectAll().data().enter().append() pattern

6.5.1 From Day 29

  • svg.selectAll("placeholder-for-rects") // This will select all placeholder elements and hand them off to the next step

  • .data(dataset) // This will bind data to the selected placeholder elements, and then return references to all elements to which data was just bound. References to these elements are called “update selection”.

  • .enter() // Select elements that do not yet exist and hand them off to the next step.

  • .append("rect") // Create a rect element within each element returned by enter(), and then return reference to this newly created element.