Skip to content

Instantly share code, notes, and snippets.

@pslusarz
Created March 16, 2014 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pslusarz/9577880 to your computer and use it in GitHub Desktop.
Save pslusarz/9577880 to your computer and use it in GitHub Desktop.
<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