|
Lubomír Sedlář |
797b3e |
function issues_history_stats_plot(url, _b, _s) {
|
|
Pierre-Yves Chibon |
cd34fb |
var svg = d3.select("svg"),
|
|
Pierre-Yves Chibon |
cd34fb |
margin = {top: 20, right: 20, bottom: 30, left: 50},
|
|
Pierre-Yves Chibon |
38bbf7 |
width = $('#stats').width() - margin.left - margin.right,
|
|
Pierre-Yves Chibon |
cd34fb |
height = +svg.attr("height") - margin.top - margin.bottom,
|
|
Pierre-Yves Chibon |
cd34fb |
g = svg.append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")");
|
|
Pierre-Yves Chibon |
cd34fb |
|
|
Pierre-Yves Chibon |
cd34fb |
var parseTime = d3.timeParse("%Y-%m-%d");
|
|
Pierre-Yves Chibon |
cd34fb |
|
|
Pierre-Yves Chibon |
cd34fb |
var x = d3.scaleTime()
|
|
Pierre-Yves Chibon |
cd34fb |
.rangeRound([0, width]);
|
|
Pierre-Yves Chibon |
cd34fb |
|
|
Pierre-Yves Chibon |
cd34fb |
var y = d3.scaleLinear()
|
|
Pierre-Yves Chibon |
cd34fb |
.rangeRound([height, 0]);
|
|
Pierre-Yves Chibon |
cd34fb |
|
|
Pierre-Yves Chibon |
cd34fb |
var area = d3.area()
|
|
Pierre-Yves Chibon |
cd34fb |
.x(function(d) { return x(d.date); })
|
|
Pierre-Yves Chibon |
cd34fb |
.y1(function(d) { return y(d.value); });
|
|
Pierre-Yves Chibon |
cd34fb |
|
|
Pierre-Yves Chibon |
cd34fb |
function draw_graph(data) {
|
|
Pierre-Yves Chibon |
cd34fb |
|
|
Pierre-Yves Chibon |
cd34fb |
x.domain(d3.extent(data, function(d) { return d.date; }));
|
|
Pierre-Yves Chibon |
cd34fb |
y.domain([0, d3.max(data, function(d) { return d.value; })]);
|
|
Pierre-Yves Chibon |
cd34fb |
area.y0(y(0));
|
|
Pierre-Yves Chibon |
cd34fb |
|
|
Pierre-Yves Chibon |
cd34fb |
g.append("path")
|
|
Pierre-Yves Chibon |
cd34fb |
.datum(data)
|
|
Pierre-Yves Chibon |
cd34fb |
.attr("fill", "steelblue")
|
|
Pierre-Yves Chibon |
cd34fb |
.attr("d", area);
|
|
Pierre-Yves Chibon |
cd34fb |
|
|
Pierre-Yves Chibon |
cd34fb |
g.append("g")
|
|
Pierre-Yves Chibon |
cd34fb |
.attr("transform", "translate(0," + height + ")")
|
|
Pierre-Yves Chibon |
cd34fb |
.call(d3.axisBottom(x));
|
|
Pierre-Yves Chibon |
cd34fb |
|
|
Pierre-Yves Chibon |
cd34fb |
g.append("g")
|
|
Pierre-Yves Chibon |
cd34fb |
.call(d3.axisLeft(y))
|
|
Pierre-Yves Chibon |
cd34fb |
.append("text")
|
|
Pierre-Yves Chibon |
cd34fb |
.attr("fill", "#000")
|
|
Pierre-Yves Chibon |
cd34fb |
.attr("transform", "rotate(-90)")
|
|
Pierre-Yves Chibon |
cd34fb |
.attr("y", 6)
|
|
Pierre-Yves Chibon |
cd34fb |
.attr("dy", "0.71em")
|
|
Pierre-Yves Chibon |
cd34fb |
.attr("text-anchor", "end")
|
|
Pierre-Yves Chibon |
cd34fb |
.text("Open Issues");
|
|
Lubomír Sedlář |
797b3e |
}
|
|
Pierre-Yves Chibon |
cd34fb |
|
|
Pierre-Yves Chibon |
cd34fb |
d3.json(url, function(d) {
|
|
Lubomír Sedlář |
4cac91 |
var _out = [];
|
|
Pierre-Yves Chibon |
cd34fb |
for (var _d in d.stats) {
|
|
Pierre-Yves Chibon |
cd34fb |
var t = {};
|
|
Pierre-Yves Chibon |
cd34fb |
t.date = parseTime(_d.split('T', 1)[0]);
|
|
Pierre-Yves Chibon |
cd34fb |
t.value = d.stats[_d];
|
|
Pierre-Yves Chibon |
cd34fb |
_out.push(t);
|
|
Pierre-Yves Chibon |
cd34fb |
}
|
|
Pierre-Yves Chibon |
cd34fb |
draw_graph(_out);
|
|
Pierre-Yves Chibon |
cd34fb |
_b.show();
|
|
Pierre-Yves Chibon |
cd34fb |
_s.hide();
|
|
Pierre-Yves Chibon |
cd34fb |
});
|
|
Lubomír Sedlář |
797b3e |
}
|
|
Pierre-Yves Chibon |
cd34fb |
|
|
Lubomír Sedlář |
797b3e |
function show_commits_authors(data) {
|
|
Pierre-Yves Chibon |
716362 |
var _b = $("#data_stats");
|
|
Pierre-Yves Chibon |
5b4c94 |
var html = 'Authors stats Since '
|
|
Pierre-Yves Chibon |
5b4c94 |
+ new Date(data.results[3]*1000) + ' there has been '
|
|
Pierre-Yves Chibon |
716362 |
+ data.results[0] + ' commits found in this repo, from '
|
|
Pierre-Yves Chibon |
716362 |
+ data.results[2] + ' contributors\n'
|
|
Pierre-Yves Chibon |
716362 |
+ '\n';
|
|
Lubomír Sedlář |
797b3e |
for (const key in data.results[1]){
|
|
Lubomír Sedlář |
797b3e |
const cnt = data.results[1][key][0];
|
|
Lubomír Sedlář |
797b3e |
for (let entry in data.results[1][key][1]){
|
|
Pierre-Yves Chibon |
609c2b |
entry = data.results[1][key][1][entry];
|
|
Pierre-Yves Chibon |
716362 |
html += '
|
|
Pierre-Yves Chibon |
716362 |
+ view_commits_url.replace('---', entry[1]) + '">'
|
|
Pierre-Yves Chibon |
409376 |
+ ' '
|
|
Pierre-Yves Chibon |
716362 |
+ entry[0]
|
|
Pierre-Yves Chibon |
609c2b |
+ '' + cnt + ' commits '
|
|
Pierre-Yves Chibon |
716362 |
+ '\n';
|
|
Pierre-Yves Chibon |
716362 |
}
|
|
Pierre-Yves Chibon |
716362 |
}
|
|
Pierre-Yves Chibon |
716362 |
html += '';
|
|
Pierre-Yves Chibon |
716362 |
_b.html(html);
|
|
Pierre-Yves Chibon |
716362 |
_b.show();
|
|
Pierre-Yves Chibon |
716362 |
}
|
|
Pierre-Yves Chibon |
716362 |
|
|
Lubomír Sedlář |
797b3e |
function show_commits_history(data) {
|
|
Pierre-Yves Chibon |
1828a2 |
var _b = $("#data_stats");
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
var parseTime = d3.timeParse("%Y-%m-%d");
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
var _out = data.results.map(function(x){
|
|
Pierre-Yves Chibon |
1828a2 |
var t = {};
|
|
Pierre-Yves Chibon |
1828a2 |
t.date = parseTime(x[0]);
|
|
Pierre-Yves Chibon |
1828a2 |
t.value = x[1];
|
|
Pierre-Yves Chibon |
1828a2 |
return t;
|
|
Lubomír Sedlář |
797b3e |
});
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
var svg = d3.select("svg"),
|
|
Pierre-Yves Chibon |
1828a2 |
margin = {top: 20, right: 20, bottom: 30, left: 50},
|
|
Pierre-Yves Chibon |
1828a2 |
width = $('#stats').width() - margin.left - margin.right,
|
|
Pierre-Yves Chibon |
1828a2 |
height = +svg.attr("height") - margin.top - margin.bottom,
|
|
Pierre-Yves Chibon |
1828a2 |
g = svg.append("g").attr(
|
|
Pierre-Yves Chibon |
1828a2 |
"transform", "translate(" + margin.left + "," + margin.top + ")");
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
var x = d3.scaleTime()
|
|
Pierre-Yves Chibon |
1828a2 |
.rangeRound([0, width]);
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
var y = d3.scaleLinear()
|
|
Pierre-Yves Chibon |
1828a2 |
.rangeRound([height, 0]);
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
var area = d3.area()
|
|
Pierre-Yves Chibon |
1828a2 |
.x(function(d) { return x(d.date); })
|
|
Pierre-Yves Chibon |
1828a2 |
.y1(function(d) { return y(d.value); });
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
function draw_graph(data) {
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
x.domain(d3.extent(data, function(d) { return d.date; }));
|
|
Pierre-Yves Chibon |
1828a2 |
y.domain([0, d3.max(data, function(d) { return d.value; })]);
|
|
Pierre-Yves Chibon |
1828a2 |
area.y0(y(0));
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
g.append("path")
|
|
Pierre-Yves Chibon |
1828a2 |
.datum(data)
|
|
Pierre-Yves Chibon |
1828a2 |
.attr("fill", "steelblue")
|
|
Pierre-Yves Chibon |
1828a2 |
.attr("d", area);
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
g.append("g")
|
|
Pierre-Yves Chibon |
1828a2 |
.attr("transform", "translate(0," + height + ")")
|
|
Pierre-Yves Chibon |
1828a2 |
.call(d3.axisBottom(x));
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
g.append("g")
|
|
Pierre-Yves Chibon |
1828a2 |
.call(d3.axisLeft(y))
|
|
Pierre-Yves Chibon |
1828a2 |
.append("text")
|
|
Pierre-Yves Chibon |
1828a2 |
.attr("fill", "#000")
|
|
Pierre-Yves Chibon |
1828a2 |
.attr("transform", "rotate(-90)")
|
|
Pierre-Yves Chibon |
1828a2 |
.attr("y", 6)
|
|
Pierre-Yves Chibon |
1828a2 |
.attr("dy", "0.71em")
|
|
Pierre-Yves Chibon |
1828a2 |
.attr("text-anchor", "end")
|
|
Pierre-Yves Chibon |
1828a2 |
.text("Number of commits");
|
|
Lubomír Sedlář |
797b3e |
}
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Pierre-Yves Chibon |
1828a2 |
draw_graph(_out);
|
|
Pierre-Yves Chibon |
1828a2 |
_b.show();
|
|
Pierre-Yves Chibon |
1828a2 |
}
|
|
Pierre-Yves Chibon |
1828a2 |
|
|
Lubomír Sedlář |
2c95bf |
function process_async(url, _data, callback) {
|
|
Lubomír Sedlář |
2c95bf |
$.post(url, _data)
|
|
Pierre-Yves Chibon |
1828a2 |
.done(function(data) {
|
|
Lubomír Sedlář |
2c95bf |
wait_for_task(data.url, callback);
|
|
Pierre-Yves Chibon |
1828a2 |
})
|
|
Lubomír Sedlář |
797b3e |
}
|
|
Pierre-Yves Chibon |
bf0bee |
|
|
Pierre-Yves Chibon |
bf0bee |
function wait_for_task(url, callback) {
|
|
Pierre-Yves Chibon |
bf0bee |
$.get(url)
|
|
Pierre-Yves Chibon |
bf0bee |
.done(function(data){
|
|
Pierre-Yves Chibon |
bf0bee |
callback(data);
|
|
Pierre-Yves Chibon |
bf0bee |
$("#data_stats_spinner").hide();
|
|
Pierre-Yves Chibon |
bf0bee |
})
|
|
Pierre-Yves Chibon |
bf0bee |
.fail(function(){
|
|
Pierre-Yves Chibon |
bf0bee |
window.setTimeout(function() {wait_for_task(url, callback);}, 1000);
|
|
Pierre-Yves Chibon |
bf0bee |
});
|
|
Pierre-Yves Chibon |
bf0bee |
}
|