Skip to content

Instantly share code, notes, and snippets.

@arfon
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arfon/22388873554782ddf297 to your computer and use it in GitHub Desktop.
Save arfon/22388873554782ddf297 to your computer and use it in GitHub Desktop.
Atom merge fraction

Fraction of pull requests to Atom that end up being merged vs time (grouped by month). The size of the dot is proportional to the number of pull requests in that time period (mouseover to see the count).

Data pulled from the GitHub API:

date unix_date merged_count not_merged_count count merge_fraction
2012-01-01 1325376000000 1 0 1 1.0
2012-03-01 1330560000000 2 0 2 1.0
2012-05-01 1335830400000 4 1 5 0.8
2012-06-01 1338508800000 12 1 13 0.9230769230769231
2012-07-01 1341100800000 2 0 2 1.0
2012-08-01 1343779200000 2 2 4 0.5
2012-09-01 1346457600000 2 2 4 0.5
2012-10-01 1349049600000 10 5 15 0.6666666666666666
2012-11-01 1351728000000 5 1 6 0.8333333333333334
2012-12-01 1354320000000 10 2 12 0.8333333333333334
2013-01-01 1356998400000 32 8 40 0.8
2013-02-01 1359676800000 36 5 41 0.8780487804878049
2013-03-01 1362096000000 20 17 37 0.5405405405405406
2013-04-01 1364774400000 18 3 21 0.8571428571428571
2013-05-01 1367366400000 9 0 9 1.0
2013-06-01 1370044800000 6 1 7 0.8571428571428571
2013-07-01 1372636800000 9 5 14 0.6428571428571429
2013-08-01 1375315200000 26 4 30 0.8666666666666667
2013-09-01 1377993600000 50 6 56 0.8928571428571429
2013-10-01 1380585600000 65 7 72 0.9027777777777778
2013-11-01 1383264000000 43 4 47 0.9148936170212766
2013-12-01 1385856000000 51 4 55 0.9272727272727272
2014-01-01 1388534400000 48 5 53 0.9056603773584906
2014-02-01 1391212800000 50 4 54 0.9259259259259259
2014-03-01 1393632000000 42 2 44 0.9545454545454546
2014-04-01 1396310400000 35 1 36 0.9722222222222222
2014-05-01 1398902400000 97 54 151 0.6423841059602649
2014-06-01 1401580800000 69 13 82 0.8414634146341463
2014-07-01 1404172800000 61 21 82 0.7439024390243902
2014-08-01 1406851200000 41 15 56 0.7321428571428571
2014-09-01 1409529600000 55 13 68 0.8088235294117647
2014-10-01 1412121600000 57 16 73 0.7808219178082192
2014-11-01 1414800000000 21 10 31 0.6774193548387096
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 12px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.dot {
stroke: red;
fill: red;
}
h1{
padding-left:25px;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.js"></script>
<script>
var margin = {top: 20, right: 20, bottom: 30, left: 50},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var parseDate = d3.time.format("%Y-%m-%d").parse;
var x = d3.time.scale()
.range([0, width]);
var y = d3.scale.linear()
.range([height, 0]);
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom");
var yAxis = d3.svg.axis()
.scale(y)
.orient("left");
var svg = d3.select("body").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
d3.tsv("atom_merge_fraction.tsv", function(error, data) {
data.forEach(function(d) {
d.date = parseDate(d.date);
d.unix_date = +d.unix_date;
d.merged_count = +d.merged_count;
d.not_merged_count = +d.not_merged_count;
d.count = +d.count;
d.merge_fraction = +d.merge_fraction;
});
x.domain(d3.extent(data, function(d) { return d.date; }));
y.domain([0, d3.max(data, function(d) { return d.merge_fraction; })]);
var median_pull_count = d3.median(data, function(d) { return d.count; });
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
svg.append("g")
.attr("class", "y axis")
.call(yAxis)
.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", ".71em")
.style("text-anchor", "end")
.text("Merge fraction");
svg.selectAll(".dot")
.data(data)
.enter().append("circle")
.attr("class", "dot")
.attr("r", function(d) { return 3 * d.count/median_pull_count; })
.attr("cx", function(d) { return x(d.date); })
.attr("cy", function(d) { return y(d.merge_fraction); })
.append("svg:title")
.text(function(d) { return d.count; });
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment