Skip to content

Instantly share code, notes, and snippets.

@jgoodall
Last active December 22, 2015 22:09
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 jgoodall/6538221 to your computer and use it in GitHub Desktop.
Save jgoodall/6538221 to your computer and use it in GitHub Desktop.
intro to d3: skeleton
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
  
console.log('append the svg to the body of the page');
var svg = d3.select("body")
.append("svg")
.attr("width", 650)
.attr("height", 500)
.append("g")
.attr("transform", "translate(" + 100 + "," + 240 + ")"); // add some margins
svg.append('text')
.style('font-size', '60px') // make the text big
.style('fill', 'green') // to color svg text, use fill
.text('d3 v' + d3.version + ' is loaded...'); // write some text
 
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment