In this blog we will learn how to bind data with D3.js. Data may be given in different format like in CSV, JSON, etc. To bind these types of data we will use built in functions.
But in this blog we will learn how to bind array format simple data:
var dataset = [ 5, 10, 15, 20, 25 ];
d3.select("body").selectAll("p")
.data(dataset)
.enter()
.append("p")
.text("New paragraph!");
.data(dataset) — Counts and parses our data values. There are five values in our data set, so everything past this point is executed five times, once for each value.