Friday, July 25, 2014

d3.js - Hello World

<!DOCTYPE html>
<html>
<head>
<!-- d3 uses extended ascii characters, so we HAVE to specify utf-8 -->
<meta charset="utf-8">
<script type="text/javascript" language="javascript" src="d3.v3.js"></script>
</head>
<body>
<script type="text/javascript">
// 1. Select a DOM element with a CSS selector
// 2. Create (and append) a new p DOM element, append it to body
// 3. Set the text of the DOM element p, to "Hello World!"
d3.select("body").append("p").text("Hello World!");
</script>
</body>
</html>

No comments: