Skip to content

Instantly share code, notes, and snippets.

@santiagogaray
Last active March 6, 2018 17:49
Show Gist options
  • Save santiagogaray/4b240e8e29f0fee41bcec37845dc425e to your computer and use it in GitHub Desktop.
Save santiagogaray/4b240e8e29f0fee41bcec37845dc425e to your computer and use it in GitHub Desktop.
Tut1
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
</head>
<body>
<script>
// Feel free to change or delete any of the code you see in this editor!
var dataArray = [20, 40, 50];
var canvas = d3.select("body").append("svg")
.attr("width", 500)
.attr("height", 500);
s = canvas.selectAll("svg")
.append("line")
//.x(function(d) {return d.x;})
var bars = canvas.selectAll("rect")
.data(dataArray)
.enter()
.append("rect")
.attr("width", function(d) {return d;})
.attr("height", 50)
.attr("y", function(d, i) {return i *100});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment