Commit 8b0266dc authored by Luko van der Maas's avatar Luko van der Maas Committed by Thom Wiggers
Browse files

added all statistics back

parent 6ef8e59c
......@@ -5,7 +5,54 @@ $(function () {
var pizzaOrders = statistics.total_pizza_orders;
var currentPizzaOrders = statistics.current_pizza_orders;
new Chart($('#membersTypeChart'), {
Chart.defaults.global.aspectRatio = 1;
Chart.defaults.global.legend.display = false;
Chart.defaults.global.title.display = true;
var pluginOptions = {
labels: {
render: 'label',
fontColor: '#000000',
arc: false,
position: 'outside',
fontsize: 16,
fontstyle: 'bold',
fontFamily: '"Open Sans"'
}
};
new Chart($('#members-type-chart'), {
type: 'pie',
data: {
labels:
[
gettext('Members'),
gettext('Supporters'),
gettext('Honorary Members'),
],
datasets: [{
backgroundColor: [
'#AE0046',
'#E62272',
'#E6478A',
],
data:
[
memberTypeDistribution.member,
memberTypeDistribution.supporter,
memberTypeDistribution.honorary
],
}]
},
options: {
title: {
text: gettext('Members per member type'),
},
plugins: pluginOptions,
}
});
new Chart($('#total-year-chart'), {
type: 'pie',
data: {
labels:
......@@ -38,22 +85,172 @@ $(function () {
}]
},
options: {
aspectRatio: 1,
legend: {
display: false
title: {
text: gettext("Total number of (honary) members and supporters per cohort"),
},
plugins: pluginOptions,
}
});
new Chart($('#members-year-chart'), {
type: 'pie',
data: {
labels:
[
cohortSizes[0].cohort,
cohortSizes[1].cohort,
cohortSizes[2].cohort,
cohortSizes[3].cohort,
cohortSizes[4].cohort,
cohortSizes[5].cohort
],
datasets: [{
backgroundColor: [
'#AE0046',
'#E62272',
'#E6478A',
'#CC2482',
'#8E1056',
'#DC3472',
],
data:
[
cohortSizes[0].member,
cohortSizes[1].member,
cohortSizes[2].member,
cohortSizes[3].member,
cohortSizes[4].member,
cohortSizes[5].member,
],
}]
},
options: {
title: {
display: true,
text: gettext("Total number of (honary) members and benefactors per cohort"),
text: gettext("Members per cohort (honorary excluded)"),
},
plugins: {
labels: {
render: 'label',
fontColor: '#fff',
arc: true,
position: 'border',
}
}
plugins: pluginOptions,
}
});
new Chart($('#benefactors-year-chart'), {
type: 'pie',
data: {
labels:
[
cohortSizes[0].cohort,
cohortSizes[1].cohort,
cohortSizes[2].cohort,
cohortSizes[3].cohort,
cohortSizes[4].cohort,
cohortSizes[5].cohort
],
datasets: [{
backgroundColor: [
'#AE0046',
'#E62272',
'#E6478A',
'#CC2482',
'#8E1056',
'#DC3472',
],
data:
[
cohortSizes[0].supporter,
cohortSizes[1].supporter,
cohortSizes[2].supporter,
cohortSizes[3].supporter,
cohortSizes[4].supporter,
cohortSizes[5].supporter,
],
}]
},
options: {
title: {
text: gettext("Supporters per cohort"),
},
plugins: pluginOptions,
}
});
new Chart($('#pizza-total-type-chart'), {
type: 'pie',
data: {
labels:
[
pizzaOrders[0].name,
pizzaOrders[1].name,
pizzaOrders[2].name,
pizzaOrders[3].name,
pizzaOrders[4].name,
pizzaOrders[5].name
],
datasets: [{
backgroundColor: [
'#AE0046',
'#E62272',
'#E6478A',
'#CC2482',
'#8E1056',
'#DC3472',
],
data:
[
pizzaOrders[0].total,
pizzaOrders[1].total,
pizzaOrders[2].total,
pizzaOrders[3].total,
pizzaOrders[4].total,
pizzaOrders[5].total
],
}]
},
options: {
title: {
text: gettext("Total pizza orders of type"),
},
plugins: pluginOptions,
}
});
if (current_pizza_orders != null) {
new Chart($('#pizza-current-type-chart'), {
type: 'pie',
data: {
labels:
[
currentPizzaOrders[0].name,
currentPizzaOrders[1].name,
currentPizzaOrders[2].name,
currentPizzaOrders[3].name,
currentPizzaOrders[4].name,
currentPizzaOrders[5].name
],
datasets: [{
backgroundColor: [
'#AE0046',
'#E62272',
'#E6478A',
'#CC2482',
'#8E1056',
'#DC3472',
],
data:
[
currentPizzaOrders[0].total,
currentPizzaOrders[1].total,
currentPizzaOrders[2].total,
currentPizzaOrders[3].total,
currentPizzaOrders[4].total,
currentPizzaOrders[5].total
],
}]
},
options: {
title: {
text: gettext("Current pizza orders of type"),
},
plugins: pluginOptions,
}
});
}
});
......@@ -13,25 +13,25 @@
<div class="row">
<div class="col-sm-6 col-lg-4">
<canvas id="membersTypeChart"></canvas>
<canvas id="members-type-chart"></canvas>
</div>
<div class="col-sm-6 col-lg-4">
<canvas id="totalYearChart"></canvas>
<canvas id="total-year-chart"></canvas>
</div>
<div class="col-sm-6 col-lg-4">
<canvas id="membersYearChart"></canvas>
<canvas id="members-year-chart"></canvas>
</div>
<div class="col-sm-6 col-lg-4">
<canvas id="benefactorsYearChart"></canvas>
<canvas id="benefactors-year-chart"></canvas>
</div>
<div class="col-sm-6 col-lg-4">
<canvas id="pizzaTotalTypeChart"></canvas>
<canvas id="pizza-total-type-chart"></canvas>
</div>
{% if current_pizza_orders != 'null' %} {# None is json-serialized to 'null' #}
<div class="col-sm-6 col-lg-4">
<canvas id="pizzaCurrentTypeChart"></canvas>
</div>
<div class="col-sm-6 col-lg-4">
<canvas id="pizza-current-type-chart"></canvas>
</div>
{% endif %}
</div>
</div>
......@@ -41,7 +41,8 @@
{% block js_body %}
{{ block.super }}
{% compress js %}
<script type="text/javascript" src="{% static 'members/js/highcharts.js' %}"></script>
<script type="text/javascript" src="{% static 'members/js/chart.min.js' %}"></script>
<script type="text/javascript" src="{% static 'members/js/chartjs-plugin-labels.min.js' %}"></script>
<script type="text/javascript" src="{% static 'members/js/statistics.js' %}"></script>
{% endcompress %}
{% endblock %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment