Created
November 9, 2017 20:58
-
-
Save bellentuck/496c867c22b94e3f66b6293068e5540c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
<title>Hello d3 World</title> | |
<script type="text/javascript" src="http://d3js.org/d3.v2.min.js"></script> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
</head> | |
<body> | |
<div id="chart"> | |
</div> | |
<script type="text/javascript" src="index.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var w = 960, h = 500, // no scrolling necessary | |
svg = d3.select("#chart") // i.e., <div id="chart"> from index.html | |
.append("svg") | |
.attr("width", w) | |
.attr("height", h); | |
/* | |
I always use that syntax, an “svg” variable that holds the top-level svg | |
container, which resides in a <div> element which has an id of “chart”. | |
--http://www.jeromecukier.net/blog/2012/09/04/getting-to-hello-world-with-d3/ | |
*/ | |
var text = svg | |
.append("text") | |
.text("Hello, d3 World!") | |
.attr("y", 50); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html, body { | |
background-color: pink; | |
} | |
text { | |
font-size: 36px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment