From ad8b5caa1bbdffed55d3aef8de72692561e84845 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 8 Dec 2005 14:10:10 +0000 Subject: [PATCH] Remplissage des vides --- .../script/graph-statistiques-tempsreels.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/telephonie/script/graph-statistiques-tempsreels.php b/htdocs/telephonie/script/graph-statistiques-tempsreels.php index 6ff219bc794..106ec8efc3d 100644 --- a/htdocs/telephonie/script/graph-statistiques-tempsreels.php +++ b/htdocs/telephonie/script/graph-statistiques-tempsreels.php @@ -70,6 +70,7 @@ if ($resql) $data = array(); $datas = array(); $moydata = array(); + $moydatas = array(); $sqla = "SELECT date, sum(duree)"; $sqla .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; @@ -87,16 +88,21 @@ if ($resql) { $jour = (substr($rowa[0],0,2) * 1); $data[$jour] = ($rowa[1]/60); - $total = $total + $data[$i]; - $moydata[$i] = $total / ($i+1); + $total = $total + $data[$jour]; $i++; + $moydata[$jour] = $total / $i; } } for ($i = 0 ; $i < 31 ; $i++) { $j = $i + 1; - $datas[$i] = $data[$j]; + $datas[$i] = 0; + $moydatas[$i] = 0; + if ($data[$j]) + $datas[$i] = $data[$j]; + if ($moydata[$j]) + $moydatas[$i] = $moydata[$j]; $labels[$i] = $j; } @@ -119,14 +125,12 @@ if ($resql) $b2plot->SetColor("red"); $graph->Add($b2plot); - $lineplot = new LinePlot($moydata); + $lineplot = new LinePlot($moydatas); $lineplot->SetColor("blue"); $graph->Add($lineplot); $graph->img->SetImgFormat("png"); $graph->Stroke($file); - - } } else