Skip to content

Instantly share code, notes, and snippets.

@m-mizutani
Created January 31, 2014 02:53
Show Gist options
  • Save m-mizutani/8725848 to your computer and use it in GitHub Desktop.
Save m-mizutani/8725848 to your computer and use it in GitHub Desktop.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
</head>
<body>
<div id="chart" style='overflow:auto; width:960px; height:480px; background: #eee;'></div>
</body>
<script type="text/javascript">
var svg = d3.select('#chart').append('svg')
.attr('width', 300)
.attr('height', 400);
var dat = [10, 20, 30];
var line = svg.append('g').selectAll('p')
.data(dat)
.enter()
.append('line')
.attr('x1', 0)
.attr('y1', function(d,i) { return d})
.attr('x2', 100)
.attr('y2', function(d,i) { return d})
.attr('stroke', '#111');
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment