|<- [[Binding data to the DOM]]|[[What is SVG]] ->| ===== creating subselections with enter() ===== // html
var objets = [ { name: 'a', color: 'red', }, { name: 'b', color: 'orange', }, { name: 'c', color: 'yellow', }, ]; d3.select('#chart').selectAll('div') // on sélectionne le chart ET les div qu'on met par la suite (et qui ne sont pas encore créés). .data(objets) .enter().append('div') .classed('item',true) .text(function (d) { return d.name; }) .style({ color: function(d) { return d.color; } });