projects_stats.html
2.78 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{% extends "base_page.html" %}
{% block more_heads %}
<link href="{{ url_for('main.static', filename='css/charges.css', version=config.VERSION) }}" rel="stylesheet"
type="text/css" />
{% endblock %}
{% block content %}
<!-- Invisible span to definte wich ul and a in the navbar are actived -->
<span id="nav_actived" style="display: none">project,projects_stats</span>
<h3 class="sub-header">Charge pour tous les projets</h3>
<div class="charge_chart" id="projects_stats_chart"></div>
{% for c in categories %}
<h3 class="sub-header">Charge pour la catégorie {{ c.name }}</h3>
<div class="charge_chart" id="labels_stats_chart_{{ c.id }}"></div>
{% endfor %}
{% endblock %}
{% block more_scripts %}
{% include 'hg-includes.html' %}
{# {% include 'd3js-includes.html' %}#}
{% include 'charges-includes.html' %}
<script>
document.addEventListener("DOMContentLoaded", function () {
//def rest_projects_stats(any_format='csv'):
var url = "{{url_for('main.rest_projects_stats', any_format='json_hs')}}";
$.getJSON(url, function (data) {
var options = {
chart: {
renderTo: 'projects_stats_chart',
type: 'streamgraph'
},
title: {
text: 'Charge pour tous les projets'
},
subtitle: {
text: '{{ categories.name }}'
},
xAxis: {
title: {
text: 'Semestre'
},
type: 'category',
},
yAxis: {
title: {
text: 'Charge (ETP)'
}
},
tooltip: {
pointFormat: '{series.name}: <b>{point.y} ETP </b>'
},
series: [],
plotOptions: {
column: {
stacking: 'normal'
}
}
};
options.series = data;
var chart = new Highcharts.Chart(options);
});
{% for c in categories %}
var url = "{{url_for('main.rest_labels_stats', category_id=c.id, any_format='json_hs')}}";
$.getJSON(url, function (data) {
var options = {
chart: {
renderTo: 'labels_stats_chart_{{c.id}}',
type: 'streamgraph'
},
title: {
text: 'Charge pour la catégorie {{c.name}}'
},
subtitle: {
text: '{{ c.name }}'
},
xAxis: {
title: {
text: 'Semestre'
},
type: 'category',
},
yAxis: {
title: {
text: 'Charge (ETP)'
}
},
tooltip: {
pointFormat: '{series.name}: <b>{point.y} ETP </b>'
},
series: [],
plotOptions: {
column: {
stacking: 'normal'
}
}
};
options.series = data;
var chart = new Highcharts.Chart(options);
});
{% endfor %}
});
</script>
{% endblock %}