Remplissage des vides
This commit is contained in:
parent
c05bf0391d
commit
ad8b5caa1b
@ -70,6 +70,7 @@ if ($resql)
|
|||||||
$data = array();
|
$data = array();
|
||||||
$datas = array();
|
$datas = array();
|
||||||
$moydata = array();
|
$moydata = array();
|
||||||
|
$moydatas = array();
|
||||||
|
|
||||||
$sqla = "SELECT date, sum(duree)";
|
$sqla = "SELECT date, sum(duree)";
|
||||||
$sqla .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr";
|
$sqla .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr";
|
||||||
@ -87,16 +88,21 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$jour = (substr($rowa[0],0,2) * 1);
|
$jour = (substr($rowa[0],0,2) * 1);
|
||||||
$data[$jour] = ($rowa[1]/60);
|
$data[$jour] = ($rowa[1]/60);
|
||||||
$total = $total + $data[$i];
|
$total = $total + $data[$jour];
|
||||||
$moydata[$i] = $total / ($i+1);
|
|
||||||
$i++;
|
$i++;
|
||||||
|
$moydata[$jour] = $total / $i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0 ; $i < 31 ; $i++)
|
for ($i = 0 ; $i < 31 ; $i++)
|
||||||
{
|
{
|
||||||
$j = $i + 1;
|
$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;
|
$labels[$i] = $j;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,14 +125,12 @@ if ($resql)
|
|||||||
$b2plot->SetColor("red");
|
$b2plot->SetColor("red");
|
||||||
$graph->Add($b2plot);
|
$graph->Add($b2plot);
|
||||||
|
|
||||||
$lineplot = new LinePlot($moydata);
|
$lineplot = new LinePlot($moydatas);
|
||||||
$lineplot->SetColor("blue");
|
$lineplot->SetColor("blue");
|
||||||
$graph->Add($lineplot);
|
$graph->Add($lineplot);
|
||||||
|
|
||||||
$graph->img->SetImgFormat("png");
|
$graph->img->SetImgFormat("png");
|
||||||
$graph->Stroke($file);
|
$graph->Stroke($file);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user