| Current Path : /home/ataenra/www/ATA/INTRANET/Admin/Gestion_ACC/charts/ |
| Current File : /home/ataenra/www/ATA/INTRANET/Admin/Gestion_ACC/charts/graphflux_PR_site.php |
<?php
$IDsite = $_GET['ID'];
$IDpmo = $_GET['IDpmo'];
$chart5 = $dbco->prepare("SELECT prod_mois, prod_kwh AS pr
FROM gest_acc_prod_mois WHERE ID_acc_site ='$IDsite'");
$chart5->execute();
$tabpr = "";
$i=1;
while ($C5 = $chart5->fetch(PDO::FETCH_OBJ)) {
if($i == 1){
$Vpr = round($C5->pr);
}else{
$Vpr = ", ".round($C5->pr)."";
}
$tabpr .= $Vpr;
$i++;
}
?>
<script>
new Chart(document.getElementById("barfluxsite"), {
type: 'bar',
data: {
labels: ['Janvier', 'Fevrier','Mars','Avril','Mai','Juin','Juillet','Aout','Septembre','Octobre','Novembre','Decembre'],
datasets: [
{
label: 'Production Solaire',
data: [<?php echo $tabpr; ?>],
backgroundColor: ['rgb(51, 206, 46)'],
stack: 'Stack 1',
},
],
},
options: {
maintainAspectRatio: true,
plugins: {
title: {
display: true,
},
},
responsive: true,
scales: {
x: {
stacked: true,
},
y: {
stacked: true
}
}
}
}
);
</script>