Skip to content

Instantly share code, notes, and snippets.

@ne8il
Last active April 12, 2018 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ne8il/5131235 to your computer and use it in GitHub Desktop.
Save ne8il/5131235 to your computer and use it in GitHub Desktop.
D3 Example 1 : Simple HTML List

Binding an array to some list elements

<!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