76 lines
2.2 KiB
Twig
76 lines
2.2 KiB
Twig
|
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
|
||
|
<script>
|
||
|
|
||
|
var dataPoints = [
|
||
|
{% for pair in statisticsSoldProducts %}
|
||
|
{
|
||
|
label: "{{ pair.name }}",
|
||
|
x: {{ pair.count }},
|
||
|
y: {{ pair.count }}
|
||
|
},
|
||
|
{% endfor %}
|
||
|
];
|
||
|
var dataPointsChiffreAffaire = [
|
||
|
{% for pair in statisticsSoldProducts %}
|
||
|
{
|
||
|
label: "{{ pair.name }}",
|
||
|
x: {{ pair.value }},
|
||
|
y: {{ pair.value }}
|
||
|
},
|
||
|
{% endfor %}
|
||
|
];
|
||
|
var dataPointsFestivals = [
|
||
|
{% for pair in statisticsFestivals %}
|
||
|
{
|
||
|
label: "{{ pair.date|date('Y-m-d') }}",
|
||
|
y: {{ pair.chiffreAffaire }} ,
|
||
|
countClients : {{ pair.clients_count }}
|
||
|
},
|
||
|
{% endfor %}
|
||
|
];
|
||
|
console.log(dataPointsFestivals);
|
||
|
var chartFestival = new CanvasJS.Chart("chartContainerstatisticsFestivals", {
|
||
|
title:{
|
||
|
text: "Chiffre d'affaire par festival"
|
||
|
},
|
||
|
animationEnabled: true,
|
||
|
data: [
|
||
|
{
|
||
|
// Change type to "doughnut", "line", "splineArea", etc.
|
||
|
type: "line",
|
||
|
dataPoints: dataPointsFestivals
|
||
|
}
|
||
|
]
|
||
|
});
|
||
|
console.log('dataPointsFestivals', dataPointsFestivals);
|
||
|
chartFestival.render();
|
||
|
var chart = new CanvasJS.Chart("chartContainer", {
|
||
|
title:{
|
||
|
text: "Volume de produits vendus"
|
||
|
},
|
||
|
animationEnabled: true,
|
||
|
data: [
|
||
|
{
|
||
|
// Change type to "doughnut", "line", "splineArea", etc.
|
||
|
type: "pie",
|
||
|
dataPoints: dataPoints
|
||
|
}
|
||
|
]
|
||
|
});
|
||
|
chart.render();
|
||
|
var chartContainerChiffreAffaire = new CanvasJS.Chart("chartContainerChiffreAffaire", {
|
||
|
title:{
|
||
|
text: "Valeur en euros des produits vendus"
|
||
|
},
|
||
|
animationEnabled: true,
|
||
|
data: [
|
||
|
{
|
||
|
// Change type to "doughnut", "line", "splineArea", etc.
|
||
|
type: "pie",
|
||
|
dataPoints: dataPointsChiffreAffaire
|
||
|
}
|
||
|
]
|
||
|
});
|
||
|
chartContainerChiffreAffaire.render();
|
||
|
</script>
|