Skip to content

Instantly share code, notes, and snippets.

@doubleshow
Created October 12, 2014 17:31
Show Gist options
  • Save doubleshow/a3771e9f0b3b2ffac777 to your computer and use it in GitHub Desktop.
Save doubleshow/a3771e9f0b3b2ffac777 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3</title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.12/d3.min.js"></script>
<style type="text/css">
</style>
</head>
<body>
<script type="text/javascript">
var w = 600;
var h = 600;
var data = [43, 23, 13, 54, 23, 9, 52, 20]
var svg = d3.select("body")
.append("svg")
.attr("width", w)
.attr("height", h);
svg.selectAll("line")
.data(data)
.enter()
.append("line")
.attr("x1", 5)
.attr("y1", 5)
.attr("x2", function (d,i){
return 5 + 50*i;
})
.attr("y2", 100)
.attr("stroke-width", 2)
.attr("stroke", "black");
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment