Skip to content

Instantly share code, notes, and snippets.

@JanneSalokoski
Last active January 2, 2017 07:24
Show Gist options
  • Save JanneSalokoski/b6a8163eb0aa8302707681d8717b0469 to your computer and use it in GitHub Desktop.
Save JanneSalokoski/b6a8163eb0aa8302707681d8717b0469 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
path
{
fill: none;
stroke: red;
stroke-width: 3px;
}
</style>
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>
</head>
<body>
<svg id="bezier" width="600" height="100">
<path />
</svg>
<script type="text/javascript">
var data = [[0, 50], [100, 80], [200, 40], [300, 60], [400, 30]];
var line = d3.line()
.curve(d3.curveCardinal);
d3.select("#bezier > path")
.attr("d", line(data));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment