Skip to content

Instantly share code, notes, and snippets.

@doubleshow
Created October 12, 2014 15:49
Show Gist options
  • Save doubleshow/24502c006029de6e3d05 to your computer and use it in GitHub Desktop.
Save doubleshow/24502c006029de6e3d05 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3</title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.12/d3.min.js"></script>
<style type="text/css">
</style>
</head>
<body>
<script type="text/javascript">
var w = 600;
var h = 600;
d3.json("https://api.github.com/orgs/csci-4830-002-2014/repos",
function(error, data) {
dataset = data;
var svg = d3.select("body")
.append("svg")
.attr("width", w)
.attr("height", h);
svg.selectAll("text")
.data(dataset)
.enter()
.append("text")
.text(function(d, i) {
return "(" + i + ") " +
"name=" + d.name + "," +
"id=" + d.id + "," +
"size=" + d.size + "," +
"forks=" + d.forks_count;
})
.attr("x", 10)
.attr("y", function(d, i) {
return 10 + 10*i;
})
.attr("font-family", "sans-serif")
.attr("font-size", "11px");
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment