From 8fe0994b54ddfeb28d2634ae487274da6b6ee3a6 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 7 Dec 2005 11:49:56 +0000 Subject: [PATCH] Ajout moyenne --- htdocs/telephonie/script/tools/graph-conso-jour.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/telephonie/script/tools/graph-conso-jour.php b/htdocs/telephonie/script/tools/graph-conso-jour.php index fbff9b9067d..a9aa54d5e6f 100644 --- a/htdocs/telephonie/script/tools/graph-conso-jour.php +++ b/htdocs/telephonie/script/tools/graph-conso-jour.php @@ -54,7 +54,7 @@ $colors[11] = 'red'; $months = array(10,11); $data = array(); -$xdata = array(); +$moydata = array(); print "$month\n"; $sql = "SELECT date_format(date,'%d'), sum(duree)"; @@ -63,7 +63,7 @@ $sql .= " WHERE date >= '2005-10-01'"; $sql .= " GROUP BY date_format(date,'%Y%m%d') ASC ;"; $resql = $db->query($sql); - +$total = 0; if ($resql) { $num = $db->num_rows($resql); @@ -72,8 +72,10 @@ if ($resql) while ($row = $db->fetch_row($resql)) { $data[$i] = ($row[1]/60000); + $total = $total + $data[$i]; $labels[$i] = $row[0]; $i++; + $moydata[$i] = $total / $i; } } else @@ -95,8 +97,13 @@ $graph->xaxis->SetTickLabels($labels); $b2plot = new LinePlot($data); $b2plot->SetWeight(2); +$b2plot->SetColor("red"); $graph->Add($b2plot); +$lineplot = new LinePlot($moydata); +$lineplot->SetColor("blue"); +$graph->Add($lineplot); + $graph->img->SetImgFormat("png"); $graph->Stroke($file); ?>