Skip to content

Instantly share code, notes, and snippets.

@paulvollmer
Last active December 17, 2015 21:39
Show Gist options
  • Save paulvollmer/5676532 to your computer and use it in GitHub Desktop.
Save paulvollmer/5676532 to your computer and use it in GitHub Desktop.
bl.ocks.org javascript template
<!DOCTYPE html>
<meta charset="utf-8">
<!-- The stylecheet ------------------------------------------------------- -->
<style>
/* HTML style */
/* SVG style */
rect {
fill: black;
stroke: red;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<!-- The javascript ------------------------------------------------------- -->
<script>
var width = 960,
height = 500;
var svg = d3.select("body")
.append("svg")
.attr("width", width)
.attr("height", height);
svg.append("rect")
.attr("x", 10)
.attr("y", 10)
.attr("width", width-20)
.attr("height", height-20);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment