Skip to content

Instantly share code, notes, and snippets.

@u110
Created April 10, 2013 13:20
Show Gist options
  • Save u110/5354552 to your computer and use it in GitHub Desktop.
Save u110/5354552 to your computer and use it in GitHub Desktop.
Introduction of d3.js http://d3js.org/
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
</head>
<body>
<p>this is a test01.</p>
<p>this is a test02.</p>
<p>this is a test03.</p>
<script>
// var paragraphs = document.getElementsByTagName("p");
// for (var i = 0; i < paragraphs.length; i++) {
// var paragraph = paragraphs.item(i);
// paragraph.style.setProperty("color", "white", null);
// }
d3.selectAll("p").style("color", "white");
// d3.select("body").style("background-color", "black");
// d3.selectAll("p").style("color", function() {
// return "hsl(" + Math.random() * 360 + ",100%,50%)";
// });
// d3.selectAll("p").style("color", function(d, i) {
// return i % 2 ? "#fff" : "#eee";
// });
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment