-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualisatie.js
107 lines (81 loc) · 2.59 KB
/
visualisatie.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
const sel = document.getElementById("cursus-select");
$(document).ready (function(){
fetch('cgi-bin/courses.py')
.then(res => res.json())
.then(res => {
for (let course in res) {
let option = document.createElement("option");
option.text = res[course];
option.value = course;
sel.add(option);
}
})
});
$(function () {
var chart;
$("#update-knop").click(function () {
fetch('cgi-bin/submissions.py?data=' + sel.options[sel.selectedIndex].value.toString())
.then(res => res.json())
.then(res => {
let studenten = [];
let aantallen = [];
for (let student_id in res) {
studenten.push('Student ' + student_id);
aantallen.push(res[student_id])
}
Highcharts.chart('container', {
chart: {
type: 'bar',
backgroundColor: '#232B2B'
},
title: {
text: '10 studenten met de meeste fouten',
style: {
color: '#808080'
}
},
legend: {
enabled: false,
},
xAxis: {
categories: studenten,
title: {
text: null
}
},
yAxis: {
min: 0,
title: {
text: 'Aantal foute inzendingen',
align: 'high'
},
labels: {
overflow: 'justify'
}
},
plotOptions: {
bar: {
dataLabels: {
enabled: false
}
}
},
credits: {
enabled: false
},
series: [{
name: 'Aantal',
data: aantallen
}]
});
});
});
});
Highcharts.setOptions({
colors: ['#DC3D24'],
plotOptions: {
column: {
colorByPoint: true
}
}
});