Built with blockbuilder.org
forked from mostaphaRoudsari's block: 02_workshop_binding data to elements
license: mit |
Built with blockbuilder.org
forked from mostaphaRoudsari's block: 02_workshop_binding data to elements
<!DOCTYPE html> | |
<head> | |
<title>d3js workshop - data binding</title> | |
<script src="http://d3js.org/d3.v3.js"></script> <!-- import D3 library --> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
// Write your code here | |
// an empty selection - looking for instantiations of data | |
place_holder = d3.selectAll('div') | |
.data(['ben', 'elcin', 'ana', 'jonatan', 'byron']) | |
.enter() | |
.append('div') | |
place_holder.text (function(d, i) {return i + 1 + " " + d;}); | |
// let's really use the data to fill each element | |
</script> | |
</body> |