Skip to content

Instantly share code, notes, and snippets.

@hunminkoh
Last active October 21, 2023 01:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hunminkoh/44b3b56c6136f8e475ef to your computer and use it in GitHub Desktop.
Save hunminkoh/44b3b56c6136f8e475ef to your computer and use it in GitHub Desktop.
Drawing a triangle with d3.svg.symbol().type("triangle-up")
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v2.min.js"></script>
</head>
<body></body>
</html>
<script type="text/javascript">
var svg = d3.select("body").append("svg")
.attr("width", window.innerWidth)
.attr("height", window.innerHeight)
.append('path')
.attr("d", d3.svg.symbol().type("triangle-up").size(500))
.attr("transform", function(d) { return "translate(" + 100 + "," + 100 + ")"; })
.style("fill", "red");
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment