Skip to content

Instantly share code, notes, and snippets.

@chmille4
Last active December 4, 2015 15:56
Show Gist options
  • Save chmille4/b69cb6e41656dc6b3b50 to your computer and use it in GitHub Desktop.
Save chmille4/b69cb6e41656dc6b3b50 to your computer and use it in GitHub Desktop.
Iobio.viz Line Chart
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
<script src="http://iobio.io/public/js/iobio.viz.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://iobio.io/public/css/iobio.viz.min.css">
<style type="text/css">
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: auto;
position: relative;
width: 960px;
}
#line-viz .line { stroke: rgb(120,176,194); }
</style>
</head>
<body>
<div id="line-viz"></div>
<script>
var m = [30, 60, 44, 70],
w = 960,
h = 500;
var data = [[1,5],[2,10],[4,20],[7,10],[10,15]];
var selection = d3.select("#line-viz").datum( data );
var chart = iobio.viz.line()
.xValue(function(d) { return d[0]; })
.yValue(function(d) { return d[1]; })
.wValue(function() { return 1; })
.height(h)
.width(w)
.margin({top: m[0], right: m[1], bottom: m[2], left:m[3]})
chart( selection );
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment