Skip to content

Instantly share code, notes, and snippets.

@davidrichards
Last active August 29, 2015 13:56
Show Gist options
  • Save davidrichards/9199094 to your computer and use it in GitHub Desktop.
Save davidrichards/9199094 to your computer and use it in GitHub Desktop.
Playing with a bit of D3
<!DOCTYPE html>
<html>
<head>
<title>D3 Demo</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.1/d3.min.js"></script>
<style type="text/css">
body {
padding-top: 50px;
padding-left: 100px;
}
.bar {
display: inline-block;
width: 20px;
height: 75px;
margin-right: 2px;
background-color: teal;
}
</style>
</head>
<body>
<script type="text/javascript">
var dataset = [ 5, 10, 15, 20, 25 ];
d3.select('body').selectAll('div')
.data(dataset)
.enter()
.append('div')
.attr('class', 'bar');
</script>
<div class="bar">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment