-
Notifications
You must be signed in to change notification settings - Fork 15
/
se_stats.js
64 lines (48 loc) · 1.55 KB
/
se_stats.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
SETagStats = function (questions) {
this.questions = questions;
this.mean = function (field) {
}
this.answered = {};
}
*/
function answered(questions)
{
var questionNumber=questions.length;
var answeredNumber=questions.filter(function(x) {return x.is_answered;}).length;
if (questionNumber>0) {return answeredNumber/questionNumber;}
else {return 0;}
}
function answersMd(questions) {
return d3.median(questions, function (q) { return q.answer_count; });
}
function answersAv(questions) {
return d3.mean(questions, function (q) { return q.answer_count; });
}
function questionsScoreMd(questions) {
return d3.median(questions, function (q) { return q.score; });
}
function questionsScoreAv(questions) {
return d3.mean(questions, function (q) { return q.score; });
}
function questionsScoreMax(questions) {
return d3.max(questions, function (q) { return q.score; });
}
function questionsViewMd(questions){
return d3.median(questions, function (q) { return q.view_count; });
}
function questionsViewAv(questions){
return d3.mean(questions, function (q) { return q.view_count; });
}
function questionsViewMax(questions){
return d3.mean(questions, function (q) { return q.view_count; });
}
function ownerReputationMd(questions){
return d3.median(questions, function (q) { return q.owner.reputation; });
}
function ownerReputationAv(questions){
return d3.mean(questions, function (q) { return q.owner.reputation; });
}
function ownerReputationMax(questions){
return d3.median(questions, function (q) { return q.owner.reputation; });
}