Skip to content

Instantly share code, notes, and snippets.

@ceeblet
Created May 4, 2015 20:39
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 ceeblet/83013d67eaa64ec1b1d7 to your computer and use it in GitHub Desktop.
Save ceeblet/83013d67eaa64ec1b1d7 to your computer and use it in GitHub Desktop.
Drawing SVG Shapes with D3 Drawin Shapes w/ D3 = // source http://jsbin.com/raboraputi
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Drawin Shapes w/ D3 = " />
<meta charset="utf-8">
<title>Drawing SVG Shapes with D3</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<h3>SVG Bar</h3>
<svg>
<rect width="50" height="200" style="fill: blue"/>
</svg>
<h3>D3 Bar</h3>
<script>
d3.select("body")
.append("svg")
.append("rect")
.attr("width", 50)
.attr("height", 200)
.style("fill", "blue");
</script>
<svg width="50", height="50">
<circle cx="25" cy="25" r="25" style="fill: blue" />
</svg>
<script id="jsbin-javascript">
d3.select("body")
.append("svg")
.attr("width", 50)
.attr("height", 50)
.append("circle")
.attr("cx", 25)
.attr("cy", 25)
.attr("r", 25)
.style("fill", "purple");
</script>
<script id="jsbin-source-javascript" type="text/javascript">d3.select("body")
.append("svg")
.attr("width", 50)
.attr("height", 50)
.append("circle")
.attr("cx", 25)
.attr("cy", 25)
.attr("r", 25)
.style("fill", "purple");
</script></body>
</html>
d3.select("body")
.append("svg")
.attr("width", 50)
.attr("height", 50)
.append("circle")
.attr("cx", 25)
.attr("cy", 25)
.attr("r", 25)
.style("fill", "purple");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment