Created
May 28, 2015 14:38
-
-
Save davbre/420237a2dc2997df3c21 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/wasagu
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var w = 200; | |
var h = 200; | |
var padding = 2; | |
var dataset = [15,30,5,60,20,100,12,13,14,15,16,123,32,15,76,46,32]; | |
var svg = d3.select("body") | |
.append("svg") | |
.attr("width", w) | |
.attr("height", h); | |
svg.selectAll("rect") | |
.data(dataset) | |
.enter() | |
.append("rect") | |
.attr("x", function(d,i) {return (i*(w/dataset.length));}) | |
.attr("y", function(d) { return h-d;}) | |
.attr("width",w/dataset.length - padding) | |
.attr("height", function(d) { return d; }); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var w = 200; | |
var h = 200; | |
var padding = 2; | |
var dataset = [15,30,5,60,20,100,12,13,14,15,16,123,32,15,76,46,32]; | |
var svg = d3.select("body") | |
.append("svg") | |
.attr("width", w) | |
.attr("height", h); | |
svg.selectAll("rect") | |
.data(dataset) | |
.enter() | |
.append("rect") | |
.attr("x", function(d,i) {return (i*(w/dataset.length));}) | |
.attr("y", function(d) { return h-d;}) | |
.attr("width",w/dataset.length - padding) | |
.attr("height", function(d) { return d; }); | |
</script></body> | |
</html> |
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
var w = 200; | |
var h = 200; | |
var padding = 2; | |
var dataset = [15,30,5,60,20,100,12,13,14,15,16,123,32,15,76,46,32]; | |
var svg = d3.select("body") | |
.append("svg") | |
.attr("width", w) | |
.attr("height", h); | |
svg.selectAll("rect") | |
.data(dataset) | |
.enter() | |
.append("rect") | |
.attr("x", function(d,i) {return (i*(w/dataset.length));}) | |
.attr("y", function(d) { return h-d;}) | |
.attr("width",w/dataset.length - padding) | |
.attr("height", function(d) { return d; }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment