Skip to content
Snippets Groups Projects
Commit 8fe0994b authored by Rodolphe Quiedeville's avatar Rodolphe Quiedeville
Browse files

Ajout moyenne

parent 0e40a480
No related branches found
No related tags found
No related merge requests found
......@@ -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);
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment