Skip to content

Instantly share code, notes, and snippets.

@lnmunhoz
Last active February 21, 2019 06:03
Show Gist options
  • Save lnmunhoz/af033df49abb0aead41b44afe02452f7 to your computer and use it in GitHub Desktop.
Save lnmunhoz/af033df49abb0aead41b44afe02452f7 to your computer and use it in GitHub Desktop.
learning d3: line
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>
<div id="chart-area"></div>
<script>
const svg = d3.select("#chart-area")
.append("svg")
.attr("width", 400)
.attr("height", 400)
.style("border", "1px solid black")
const line = svg.append("line")
.attr("x1", 10)
.attr("y1", 10)
.attr("x2", 390)
.attr("y2", 390)
.attr("stroke", "blue")
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment