week & day stat
This commit is contained in:
parent
e4c8209df8
commit
3a7ffefacf
4 changed files with 378 additions and 2 deletions
88
kfet/templates/kfet/article_stat.html
Normal file
88
kfet/templates/kfet/article_stat.html
Normal file
|
@ -0,0 +1,88 @@
|
|||
<!doctype html>
|
||||
{% load staticfiles %}
|
||||
|
||||
<body>
|
||||
<canvas id="{{ chart_id }}"></canvas>
|
||||
|
||||
{% comment %}
|
||||
TODO : supprimer les fichiers script jQuery et Chart.js
|
||||
{% endcomment %}
|
||||
<script src="{% static 'kfet/js/Chart.bundle.js' %}"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
var ctx1 = $({{ chart_id }});
|
||||
var myChart = new Chart(ctx1, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [
|
||||
{% for k,label in labels.items %}
|
||||
{% if forloop.last %}
|
||||
"{{ label }}"
|
||||
{% else %}
|
||||
"{{ label }}",
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
datasets: [{
|
||||
label: 'Toutes consomations',
|
||||
borderColor: 'rgb(255, 99, 132)',
|
||||
backgroundColor: 'rgb(255, 99, 132)',
|
||||
data: [
|
||||
{% for k,nb in nb_ventes.items %}
|
||||
{% if forloop.last %}
|
||||
"{{ nb }}"
|
||||
{% else %}
|
||||
"{{ nb }}",
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
fill: false,
|
||||
lineTension: 0,
|
||||
} , {
|
||||
label: 'LIQ',
|
||||
borderColor: 'rgb(54, 162, 235)',
|
||||
backgroundColor: 'rgb(54, 162, 235)',
|
||||
data: [
|
||||
{% for k,nb in nb_liq.items %}
|
||||
{% if forloop.last %}
|
||||
"{{ nb }}"
|
||||
{% else %}
|
||||
"{{ nb }}",
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
fill: false,
|
||||
lineTension: 0,
|
||||
} , {
|
||||
label: 'Comptes K-Fêt',
|
||||
borderColor: 'rgb(255, 205, 86)',
|
||||
backgroundColor: 'rgb(255, 205, 86)',
|
||||
data: [
|
||||
{% for k,nb in nb_accounts.items %}
|
||||
{% if forloop.last %}
|
||||
"{{ nb }}"
|
||||
{% else %}
|
||||
"{{ nb }}",
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
fill: false,
|
||||
lineTension: 0,
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
tooltips: {
|
||||
mode: 'nearest',
|
||||
intersect: false,
|
||||
},
|
||||
hover: {
|
||||
mode: 'nearest',
|
||||
intersect: false,
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue