[ Launch: GitHub Repos ] 6130361 by audreyr
Created
August 1, 2013 10:56
-
-
Save audreyfeldroy/6130361 to your computer and use it in GitHub Desktop.
Bar Chart of My First 29 GitHub Repos
Watchers per repo, for each of my repos. Note: The GitHub API only lets me get the first few repos, so the list is incomplete.
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
{"description":"Bar Chart of My First 29 GitHub Repos","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"README.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"index.html":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/d6SDi4x.png"} |
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
<svg width="940" height="1000"></svg> | |
<style> | |
text { | |
font: 10px sans-serif; | |
} | |
</style> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="inlet.js"></script> |
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 data; | |
function calc_y(d) { | |
return data.indexOf(d) * 30 + 20; | |
} | |
function calc_y_caption(d) { | |
return calc_y(d) - 4; | |
} | |
d3.json("https://api.github.com/users/audreyr/repos", function(json) { | |
data = json; | |
var bar = d3.select("svg").selectAll(".bar") | |
.data(json) | |
.enter().append("g") | |
.attr("class", "bar"); | |
bar.append("rect") | |
.attr("x", 20) | |
.attr("y", calc_y) | |
.attr("width", function(d) { return d.watchers_count * 5 }) | |
.attr("height", 10) | |
.style("fill", function(d) { return '#000000' }); | |
bar.append("text") | |
.style("text-anchor", "start") | |
.attr("x", 20) | |
.attr("y", calc_y_caption) | |
.text(function(d) { return d.name }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment