Skip to content

Instantly share code, notes, and snippets.

@biovisualize
Forked from larskotthoff/index.html
Last active September 1, 2015 19:52
Show Gist options
  • Save biovisualize/17a6ca673efd9b370b36 to your computer and use it in GitHub Desktop.
Save biovisualize/17a6ca673efd9b370b36 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="https://rawgit.com/biovisualize/b9a321c5038d24206356/raw/d6c542f19772b28d19c5be056f6f084ed6d71974/line-variable.js"></script>
</head>
<body>
<div id="linevar"></div>
<script type="text/javascript">
(function () {
var dat = [{x: 20, y: 20, w: 0},
{x: 20, y: 150, w: 30},
{x: 80, y: 100, w: 20},
{x: 200, y: 100, w: 10},
{x: 300, y: 100, w: 20},
{x: 380, y: 100, w: 0}],
svg = d3.select("#linevar")
.append("svg:svg")
.attr("height", 200)
.attr("width", 400);
var linevar = d3.svg.line.variable()
.interpolate("basis")
.w(function(d) { return d.w; })
.x(function(d) { return d.x; })
.y(function(d) { return d.y; });
svg.selectAll("path").data([dat]).enter()
.append("svg:path")
.attr("d", linevar);
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment