Binding an array to some list elements
Last active
April 12, 2018 13:20
-
-
Save ne8il/5131235 to your computer and use it in GitHub Desktop.
D3 Example 1 : Simple HTML List
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<head> | |
<style> | |
body { | |
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
width: 960px; | |
height: 500px; | |
position: relative; | |
} | |
</style> | |
</head> | |
<body> | |
</body> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script> | |
var names = ['Frank', 'Tom', 'Peter', 'Mary']; | |
var ul = d3.select('body').append('ul'); | |
ul.selectAll('li') | |
.data(names) | |
.enter() | |
.append('li') | |
.html(String); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment