IT:AD:D3.JS:HowTo:Transitions
Summary
Process
Recap:
- when you
selectAllyou are getting an Array of DOM elements (actually an array of arrays, but lets gloss over that for now) - when you apply
data()to a selection the data is embedded in the dom element (yeah…I was a bit surprised the first time I learnt that).- it's the equivalent of calling
d3.select('div').datum(whatever)on the dom element.
So here's an example of:
- binding some data to some elements
- getting a single element
- updating its datum
- applying another transition.
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: