Skip to content

Instantly share code, notes, and snippets.

@itzikbenh
Created June 3, 2017 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itzikbenh/624cfbec3bc9962b77bbb1aa6bb4b419 to your computer and use it in GitHub Desktop.
Save itzikbenh/624cfbec3bc9962b77bbb1aa6bb4b419 to your computer and use it in GitHub Desktop.
fresh block
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<script>
var dataArray = [{x:5,y:5},{x:10,y:15},{x:20,y:7},{x:30,y:18},{x:40,y:10}];
var svg = d3.select("body").append("svg").attr("height","100%").attr("width","100%");
var line = d3.line()
.x(function(d,i){ return d.x*6; })
.y(function(d,i){ return d.y*4; });
svg.append("path")
.attr("fill","none")
.attr("stroke","blue")
.attr("d",line(dataArray));
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment