Recap:
selectAll you are getting an Array of DOM elements (actually an array of arrays, but lets gloss over that for now)data() to a selection the data is embedded in the dom element (yeah…I was a bit surprised the first time I learnt that).d3.select('div').datum(whatever) on the dom element.So here's an example of:
An alternative way of selecting a single element – or any subset of an element is as follows:
But in most cases I'll bet you'll be updating, or reimporting fresh data - in which case you'll want to update the whole set again: