D3 implements the JOIN + INSERT / UPDATE / DELETE template, well known from the database world. In d3, you first select some DOM elements and then attach them to the data:
//join existing 'g.class' DOM elements with `data` elements
var join = d3.select('g.class').data(data)
//get the join pairs that did not have 'g.class' join partner and
//INSERT new 'g.class' DOM elements into the "empty slots"
join.enter().append('g').attr('class', 'class')
//get the join pairs that did not have a `data` element as join partner and
//DELETE the existing 'g.class' DOM elements
join.exit().remove()
//get the join pairs that have a `data` element join partner and
//UPDATE the 'g.class' DOM elements
join.attr("name","value")
, , , . , . .
D3 . , treemap , treemap.nodes, , . treemap x,y,width,height . .
"" , , , (, ), , / (, node ). .