140 lines
2.9 KiB
HTML
140 lines
2.9 KiB
HTML
{% extends 'base.html' %}
|
|
|
|
{% load image_tags %}
|
|
|
|
{% block main_container %}
|
|
|
|
<script type="text/javascript" src="{{ STATIC_URL }}js/highcharts.js"></script>
|
|
<script type="text/javascript" src="{{ STATIC_URL }}js/modules/exporting.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
var chart;
|
|
|
|
var barChat;
|
|
|
|
$(document).ready(function() {
|
|
Highcharts.setOptions({
|
|
colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4']
|
|
});
|
|
|
|
chart = new Highcharts.Chart({
|
|
chart: {
|
|
renderTo: 'container',
|
|
plotBackgroundColor: null,
|
|
plotBorderWidth: null,
|
|
plotShadow: false
|
|
},
|
|
title: {
|
|
text: 'Nombre de cartes par pays'
|
|
},
|
|
tooltip: {
|
|
pointFormat: '{series.name}: <b>{point.percentage}%</b>',
|
|
percentageDecimals: 1
|
|
},
|
|
plotOptions: {
|
|
pie: {
|
|
allowPointSelect: true,
|
|
cursor: 'pointer',
|
|
dataLabels: {
|
|
enabled: true,
|
|
color: '#000000',
|
|
connectorColor: '#000000',
|
|
formatter: function() {
|
|
return '<b>'+ this.point.name +'</b>: '+ this.percentage.toFixed(2) +' %';
|
|
}
|
|
}
|
|
}
|
|
},
|
|
series: [{
|
|
type: 'pie',
|
|
name: 'Browser share',
|
|
data: [
|
|
{% for country in countries %}
|
|
['{{country.label}}', {{country.num_cards}}],
|
|
{% endfor %}
|
|
]
|
|
}]
|
|
});
|
|
|
|
barChart = new HighCharts.Chart({
|
|
renderTo: 'barContainer',
|
|
chart: {
|
|
type: 'bar'
|
|
},
|
|
title: {
|
|
text: 'Historic World Population by Region'
|
|
},
|
|
subtitle: {
|
|
text: 'Source: Wikipedia.org'
|
|
},
|
|
xAxis: {
|
|
categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
|
|
title: {
|
|
text: null
|
|
}
|
|
},
|
|
yAxis: {
|
|
min: 0,
|
|
title: {
|
|
text: 'Population (millions)',
|
|
align: 'high'
|
|
},
|
|
labels: {
|
|
overflow: 'justify'
|
|
}
|
|
},
|
|
tooltip: {
|
|
formatter: function() {
|
|
return ''+
|
|
this.series.name +': '+ this.y +' millions';
|
|
}
|
|
},
|
|
plotOptions: {
|
|
bar: {
|
|
dataLabels: {
|
|
enabled: true
|
|
}
|
|
}
|
|
},
|
|
legend: {
|
|
layout: 'vertical',
|
|
align: 'right',
|
|
verticalAlign: 'top',
|
|
x: -100,
|
|
y: 100,
|
|
floating: true,
|
|
borderWidth: 1,
|
|
backgroundColor: '#FFFFFF',
|
|
shadow: true
|
|
},
|
|
credits: {
|
|
enabled: false
|
|
},
|
|
series: [{
|
|
name: 'Year 1800',
|
|
data: [107, 31, 635, 203, 2]
|
|
}, {
|
|
name: 'Year 1900',
|
|
data: [133, 156, 947, 408, 6]
|
|
}, {
|
|
name: 'Year 2008',
|
|
data: [973, 914, 4054, 732, 34]
|
|
}]
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<h2>Stats, tout ça</h2>
|
|
|
|
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto">
|
|
|
|
</div>
|
|
|
|
<div id="barContainer" style="min-width: 400px; height: 400px; margin: 0 auto">
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|