D3 Review

D3 Selection

A selection is an array of groups, and each group is an array of elements

D3 Selection

The group is selection[0] and the node

is selection[0][0]

D3 Selection

Data Bounding

  • Data is not a property of the selection, but a property of its elements
  • Data is assigned to the __data__ property of each element

Data Bounding

Changing Style

selection.attr("some_attr", function(d, i) { this.something = ...; })
selection.style("some_style", function(d, i) { this.something = ...; })

this

i

d

D3 Review

By Wenbin He

D3 Review

  • 558