Skip to content

Instantly share code, notes, and snippets.

@santiagogaray
Last active March 6, 2018 18:11
Show Gist options
  • Save santiagogaray/cab22eec8211fef83ef418e6e4ddba59 to your computer and use it in GitHub Desktop.
Save santiagogaray/cab22eec8211fef83ef418e6e4ddba59 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>
</head>
<body>
<script>
// Feel free to change or delete any of the code you see in this editor!
var canvas = d3.select("body").append("svg")
.attr("width", 500)
.attr("height", 500);
var data = [
{x:10, y:20},
{x:40, y:60},
{x:50, y:70}
];
var group = canvas.append("g")
.attr("transform", "translate(100,100)");
var line = d3.line()
.x(function(d) {return d.x;})
.y(function(d) {return d.y;});
group.selectAll("path")
.data([data])
.enter()
.append("path")
.attr("d", line)
.attr("fill", "none")
.attr("stroke", "#0000")
.attr("stroke-width", 10);
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment