Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 568 Bytes

0314.md

File metadata and controls

24 lines (17 loc) · 568 Bytes

Enter the Data

Enter Selections

What if you don't know how much data you have?

An enter selection is the set of data elements that do not have an associated html element

var info = [57, 239, 2];
var container = d3.select("svg");
circles = container.selectAll("circle").data(info).enter();

circles is now an array of 3 objects with associated adata

circles.append("circle")

  • Appends circle elements to the svg container
circles.append("circle").attr("cy", 250).attr("r", 40).attr("cx", function(d) {
  return d;
});