1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| <?php
require_once("./../../jpgraph14/jpgraph.php");
require_once("./../../jpgraph14/jpgraph_bar.php");
function imagegraph2()
{
$correspondence=imb($_SESSION['graph_user'],$_SESSION['graph_password']);
$nbra = count($correspondence[$_SESSION['box_id']]);
$k=60;
for ($j=0;$j<count($_POST['evts']);$j++)
{
for($i=0 ;$i < $nbra-1;$i++)
{
$result=getimb($_SESSION['graph_user'], $_SESSION['graph_password'], $_POST['box'], $correspondence[$_SESSION['box_id']][$i][1], $_POST['evts'][$j]);
$a = array_sum($result); //jé une liste de valeurs
echo '<BR>'.'- - -'.$a.'<BR>'; //pour verifier si je récupere bien le rslt de $a, il m affiche bien les valeurs
$bplot[$i] = new BarPlot($a); //tracage du graphique
$k+=25;
}
}
$vH=$k+400;
// initialisation du graphique
if(isset($_GET['big']) && $_GET['big']=='yes')
$graph = new Graph(4000,2000,'auto');
else
$graph = new Graph(675,$vH,'auto');
// affichage de l'axe X
$graph->xaxis->title->Set('Les boxs);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
for($i=0 ;$i < $nbra-1;$i++)
{
$xdata[$i]=$correspondence[$_SESSION['b_id']][$i][0];
}
$graph->xaxis->SetTickLabels($xdata);
// affichage de l'axe Y
$graph->yaxis->title->Set('Qté');
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->img->SetMargin(40,40,40,$k);
//ajout de l'histogramme au graphique
$gbarplot = new GroupBarPlot($bplot);
$gbarplot->SetWidth(0.9);
$graph->Add($gbarplot);
//affichage de graphique
$graph->Stroke();
}
?> |
Partager