You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9 lines
510 B
JavaScript

5 years ago
//Binding DATA to DOM element - SIMPLE Example
//assume the body is empty
var theData = [ 1, 2, 3 ]
var a = d3.select("body").selectAll("p") //returns empty selection
.data(theData) // creates 3 empty placeholders as there are three data items
.enter() // gives us reference/pointer to manipulate 3 placeholders. Using the reference we can append, insert and select
.append("p") //appending <p></p> to the references
.text("It if fun to Design Frontend "); //adding hello to the paragraph text