dvd3js:creating_subselections_with_enter
creating subselections with enter()
// html <section id="chart"></section>
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;
}
});
dvd3js/creating_subselections_with_enter.txt · Last modified: 2016/04/14 15:52 by leo