Skip to content

Instantly share code, notes, and snippets.

@arfon
Last active August 29, 2015 13:55
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/8777862 to your computer and use it in GitHub Desktop.
Save arfon/8777862 to your computer and use it in GitHub Desktop.
Redis PR merge fraction

Fraction of pull requests to Redis merged over 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:

<!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("redis_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(d3.extent(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>
date unix_date merged_count not_merged_count count merge_fraction
2010-08-30 1283126400000 1 0 1 1.0
2010-09-06 1283731200000 0 1 1 0.0
2010-09-13 1284336000000 2 0 2 1.0
2010-09-27 1285545600000 0 2 2 0.0
2010-10-11 1286755200000 0 1 1 0.0
2010-10-25 1287964800000 0 3 3 0.0
2010-11-01 1288569600000 0 2 2 0.0
2010-11-08 1289174400000 0 2 2 0.0
2010-11-15 1289779200000 0 2 2 0.0
2010-11-22 1290384000000 0 1 1 0.0
2010-12-06 1291593600000 1 1 2 0.5
2010-12-20 1292803200000 0 1 1 0.0
2010-12-27 1293408000000 0 2 2 0.0
2011-01-03 1294012800000 0 3 3 0.0
2011-01-17 1295222400000 0 1 1 0.0
2011-01-24 1295827200000 0 1 1 0.0
2011-01-31 1296432000000 0 2 2 0.0
2011-02-14 1297641600000 0 2 2 0.0
2011-02-21 1298246400000 0 2 2 0.0
2011-03-21 1300665600000 0 2 2 0.0
2011-04-11 1302480000000 0 1 1 0.0
2011-04-18 1303084800000 0 2 2 0.0
2011-04-25 1303689600000 0 1 1 0.0
2011-05-09 1304899200000 0 3 3 0.0
2011-05-30 1306713600000 0 1 1 0.0
2011-06-06 1307318400000 1 1 2 0.5
2011-06-13 1307923200000 1 3 4 0.25
2011-06-20 1308528000000 1 1 2 0.5
2011-06-27 1309132800000 0 3 3 0.0
2011-07-04 1309737600000 0 1 1 0.0
2011-07-11 1310342400000 1 2 3 0.3333333333333333
2011-07-25 1311552000000 1 1 2 0.5
2011-08-01 1312156800000 1 0 1 1.0
2011-08-08 1312761600000 0 1 1 0.0
2011-08-22 1313971200000 2 1 3 0.6666666666666666
2011-08-29 1314576000000 1 0 1 1.0
2011-09-19 1316390400000 1 1 2 0.5
2011-10-03 1317600000000 3 1 4 0.75
2011-10-10 1318204800000 1 1 2 0.5
2011-10-17 1318809600000 4 0 4 1.0
2011-10-24 1319414400000 1 1 2 0.5
2011-10-31 1320019200000 1 0 1 1.0
2011-11-07 1320624000000 1 0 1 1.0
2011-11-14 1321228800000 2 0 2 1.0
2011-11-21 1321833600000 3 0 3 1.0
2011-11-28 1322438400000 0 4 4 0.0
2011-12-05 1323043200000 0 2 2 0.0
2011-12-12 1323648000000 0 2 2 0.0
2011-12-19 1324252800000 2 1 3 0.6666666666666666
2011-12-26 1324857600000 1 2 3 0.3333333333333333
2012-01-02 1325462400000 1 1 2 0.5
2012-01-09 1326067200000 1 2 3 0.3333333333333333
2012-01-16 1326672000000 1 1 2 0.5
2012-01-23 1327276800000 1 3 4 0.25
2012-01-30 1327881600000 1 0 1 1.0
2012-02-13 1329091200000 1 0 1 1.0
2012-02-20 1329696000000 3 6 9 0.3333333333333333
2012-03-05 1330905600000 1 3 4 0.25
2012-03-12 1331510400000 1 1 2 0.5
2012-03-26 1332720000000 5 9 14 0.35714285714285715
2012-04-02 1333324800000 4 3 7 0.5714285714285714
2012-04-09 1333929600000 3 4 7 0.42857142857142855
2012-04-16 1334534400000 1 2 3 0.3333333333333333
2012-04-23 1335139200000 1 2 3 0.3333333333333333
2012-04-30 1335744000000 4 2 6 0.6666666666666666
2012-05-07 1336348800000 0 1 1 0.0
2012-05-14 1336953600000 1 2 3 0.3333333333333333
2012-05-21 1337558400000 0 2 2 0.0
2012-05-28 1338163200000 0 2 2 0.0
2012-06-04 1338768000000 1 3 4 0.25
2012-06-11 1339372800000 1 2 3 0.3333333333333333
2012-06-25 1340582400000 1 0 1 1.0
2012-07-02 1341187200000 1 3 4 0.25
2012-07-09 1341792000000 0 2 2 0.0
2012-07-16 1342396800000 3 4 7 0.42857142857142855
2012-07-23 1343001600000 4 1 5 0.8
2012-07-30 1343606400000 1 3 4 0.25
2012-08-06 1344211200000 0 1 1 0.0
2012-08-13 1344816000000 1 1 2 0.5
2012-08-20 1345420800000 0 1 1 0.0
2012-08-27 1346025600000 0 6 6 0.0
2012-09-10 1347235200000 0 2 2 0.0
2012-09-17 1347840000000 0 2 2 0.0
2012-10-01 1349049600000 1 0 1 1.0
2012-10-08 1349654400000 1 1 2 0.5
2012-10-22 1350864000000 2 9 11 0.18181818181818182
2012-10-29 1351468800000 2 3 5 0.4
2012-11-05 1352073600000 0 1 1 0.0
2012-11-12 1352678400000 0 4 4 0.0
2012-11-19 1353283200000 2 6 8 0.25
2012-11-26 1353888000000 0 8 8 0.0
2012-12-03 1354492800000 1 2 3 0.3333333333333333
2012-12-10 1355097600000 2 9 11 0.18181818181818182
2012-12-17 1355702400000 0 6 6 0.0
2012-12-24 1356307200000 1 5 6 0.16666666666666666
2012-12-31 1356912000000 0 3 3 0.0
2013-01-07 1357516800000 1 5 6 0.16666666666666666
2013-01-14 1358121600000 6 6 12 0.5
2013-01-21 1358726400000 1 4 5 0.2
2013-01-28 1359331200000 2 2 4 0.5
2013-02-04 1359936000000 3 3 6 0.5
2013-02-11 1360540800000 0 3 3 0.0
2013-02-18 1361145600000 1 8 9 0.1111111111111111
2013-02-25 1361750400000 1 6 7 0.14285714285714285
2013-03-04 1362355200000 0 5 5 0.0
2013-03-11 1362960000000 2 2 4 0.5
2013-03-18 1363564800000 1 3 4 0.25
2013-03-25 1364169600000 0 3 3 0.0
2013-04-08 1365379200000 0 4 4 0.0
2013-04-15 1365984000000 0 4 4 0.0
2013-04-22 1366588800000 0 3 3 0.0
2013-04-29 1367193600000 0 3 3 0.0
2013-05-06 1367798400000 1 4 5 0.2
2013-05-13 1368403200000 1 6 7 0.14285714285714285
2013-05-20 1369008000000 1 6 7 0.14285714285714285
2013-05-27 1369612800000 0 2 2 0.0
2013-06-03 1370217600000 0 3 3 0.0
2013-06-10 1370822400000 0 4 4 0.0
2013-06-17 1371427200000 1 3 4 0.25
2013-07-01 1372636800000 0 4 4 0.0
2013-07-08 1373241600000 2 6 8 0.25
2013-07-15 1373846400000 1 4 5 0.2
2013-07-22 1374451200000 1 5 6 0.16666666666666666
2013-07-29 1375056000000 0 2 2 0.0
2013-08-05 1375660800000 1 2 3 0.3333333333333333
2013-08-12 1376265600000 1 6 7 0.14285714285714285
2013-08-19 1376870400000 0 1 1 0.0
2013-08-26 1377475200000 0 1 1 0.0
2013-09-02 1378080000000 0 1 1 0.0
2013-09-09 1378684800000 0 4 4 0.0
2013-09-16 1379289600000 0 1 1 0.0
2013-09-23 1379894400000 0 3 3 0.0
2013-09-30 1380499200000 0 2 2 0.0
2013-10-07 1381104000000 0 2 2 0.0
2013-10-14 1381708800000 0 9 9 0.0
2013-10-21 1382313600000 0 6 6 0.0
2013-10-28 1382918400000 0 6 6 0.0
2013-11-04 1383523200000 3 4 7 0.42857142857142855
2013-11-11 1384128000000 0 3 3 0.0
2013-11-18 1384732800000 0 2 2 0.0
2013-11-25 1385337600000 2 5 7 0.2857142857142857
2013-12-02 1385942400000 4 9 13 0.3076923076923077
2013-12-09 1386547200000 1 5 6 0.16666666666666666
2013-12-16 1387152000000 0 2 2 0.0
2013-12-23 1387756800000 0 4 4 0.0
2014-01-06 1388966400000 0 3 3 0.0
2014-01-13 1389571200000 0 3 3 0.0
2014-01-20 1390176000000 0 3 3 0.0
2014-01-27 1390780800000 0 2 2 0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment