Ajout des chiffres pour l'agglo entière
This commit is contained in:
parent
c2c9ff2c50
commit
269266de77
@ -84,16 +84,34 @@ while($line = $data->fetchArray()) {
|
|||||||
$dataset_angers[] = array('x' => date_format(date_create($line['date']), 'Y/m/d H:i'), 'y'=>$line['nombre']);
|
$dataset_angers[] = array('x' => date_format(date_create($line['date']), 'Y/m/d H:i'), 'y'=>$line['nombre']);
|
||||||
}
|
}
|
||||||
$json_angers = json_encode($dataset_angers);
|
$json_angers = json_encode($dataset_angers);
|
||||||
|
$data = $base->query("SELECT date, SUM(nombre) as nombre FROM chiffres GROUP BY date");
|
||||||
|
$dataset_tout = [];
|
||||||
|
while($line = $data->fetchArray()) {
|
||||||
|
$dataset_tout[] = array('x' => date_format(date_create($line['date']), 'Y/m/d H:i'), 'y'=>$line['nombre']);
|
||||||
|
}
|
||||||
|
$json_tout = json_encode($dataset_tout);
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
const data_angers = <?=$json_angers?>;
|
const data_angers = <?=$json_angers?>;
|
||||||
|
const data_tout = <?=$json_tout?>;
|
||||||
(async function() {
|
(async function() {
|
||||||
const myChart = new Chart(document.getElementById('graphe_angers'), { type:'line', data: {datasets: [{
|
const myChart = new Chart(document.getElementById('graphe_angers'), {
|
||||||
|
type:'line',
|
||||||
|
data: {
|
||||||
|
datasets: [{
|
||||||
type: 'line',
|
type: 'line',
|
||||||
label:"Angers",
|
label:"Angers",
|
||||||
data: data_angers,
|
data: data_angers,
|
||||||
tension: 0.1
|
tension: 0.1
|
||||||
}]}});
|
},
|
||||||
|
{
|
||||||
|
type: 'line',
|
||||||
|
label: "Agglomération entière",
|
||||||
|
data: data_tout,
|
||||||
|
tension: 0.1
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
});
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
BIN
barometre.sqlite
BIN
barometre.sqlite
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user