Created
March 16, 2014 02:53
-
-
Save pslusarz/9577880 to your computer and use it in GitHub Desktop.
This file contains 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
<html> | |
<body> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script> | |
var svg = d3.select('body').append('svg') | |
.attr("height", 200) | |
.attr("width", 200); | |
var nums = [80, 53, 125, 200, 28, 97]; | |
var bars = svg.selectAll('rect') | |
.data(nums); | |
bars.enter().append('rect'); | |
bars | |
.attr('width', 20) | |
.attr('height', 20); | |
bars.attr('x', function(d, i) { | |
return 30*i; | |
}); | |
bars.attr("height", function(d, i) { | |
return d; | |
}); | |
bars.attr("y", function(d, i) { | |
return 200 - d; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment