Last active
August 29, 2015 13:56
-
-
Save davidrichards/9199094 to your computer and use it in GitHub Desktop.
Playing with a bit of D3
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> | |
<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