Skip to content

Instantly share code, notes, and snippets.

@kousherAlam
Last active July 2, 2019 05:15
Show Gist options
  • Save kousherAlam/ca1f17daa76453070a6c23c043fb2d62 to your computer and use it in GitHub Desktop.
Save kousherAlam/ca1f17daa76453070a6c23c043fb2d62 to your computer and use it in GitHub Desktop.
d3-test-01
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body {
margin:0;
margin-top: 30px;
padding: 15px;
}
svg{
border: 1px solid black;
box-shadow: 0px 0px 5px 2px rgba(0,0,0,.4);
}
</style>
</head>
<body>
<script>
// Feel free to change or delete any of the code you see in this editor!
const config = {
width: 670,
height: 500,
bar: {
width: 50,
height: 400,
}
}
var svg = d3.select("body").append("svg")
.attr("width", 670)
.attr("height", 500)
/*
* M = Move --- M(x y)
* L = Line L(x y)
* z = End
*/
svg.append("path")
.attr("d", "M150 50 L75 200 L225 200 Z")
/*
svg.append("rect")
.attr("x", 10)
.attr("y", config.height - config.bar.height)
.attr("width", config.bar.width)
.attr("height", config.bar.height)
svg.append("text")
.text("Edit the code below to change me!")
.attr("y", 200)
.attr("x", 120)
.attr("font-size", 36)
.attr("font-family", "monospace")
*/
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment