-
Notifications
You must be signed in to change notification settings - Fork 0
/
statistics.js
73 lines (71 loc) · 1.79 KB
/
statistics.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
65
66
67
68
69
70
71
72
73
$(document).ready(function() {
loadGraph();
$('.list').hide();
$('#detained').hide();
$('.classes').click(function() {
$('.classes').css('font-weight','');
if($(this).find('.list').css('display') == 'block') {
$('.list').slideUp('fast');
} else {
$(this).css('font-weight','bold');
$('.list').slideUp('fast');
$(this).find('.list').slideDown('fast');
}
});
$('a[href=#detained]').click(function() {
$('.wrapper .active').removeClass('active');
$(this).parent().addClass('active');
$('#graph').slideUp('fast',function() {
$('#detained').show('fast');
$('html,body').animate({ scrollTop: $('#detained').offset().top}, 500);
});
});
$('a[href=#graph]').click(function() {
$('.wrapper .active').removeClass('active');
$(this).parent().addClass('active');
$('#detained').slideUp('fast',function() {
$('#graph').show('fast');
$('html,body').animate({ scrollTop: $('#graph').offset().top}, 500);
});
});
});
function loadGraph() {
totals = new Array();
averages = new Array();
keys = new Array();
for(var a in data) {
keys.push(a);
totals.push(data[a].total);
averages.push(data[a].average);
}
$('.content #graph').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Average Attendance'
},
xAxis: {
categories: keys
},
yAxis: {
min: 0,
title: {
text: 'Count of Days'
}
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series: [{
name: 'Total Days',
data: totals
}, {
name: 'Average Attendance',
data: averages
}]
});
}