In an effort incrementally introduce complexity, data is bound one datum
at a time with a for
loop to blend the declarative/functional paradigm of D3 and the imperative/procedural paradigm of standard Javascript.
In this example we can see how D3's data binding functions (data()
and datum()
) create a closure encapsulating the state of variables at the time the data is bound.
Built with blockbuilder.org
forked from Jay-Oh-eN's block: Foundations of D3: Data Binding Scope
forked from margeigh's block: Foundations of D3: Data Binding Scope
forked from margeigh's block: Foundations of D3: Data Binding Scope
forked from margeigh's block: Foundations of D3: Data Binding Scope
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js