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
|
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_line.php');
$largeur = 170 + ($nb_tours * 25);
$hauteur = $nb_pilotes * 30;
function _cb_negate($aVal) {return round(-$aVal);}
$nb_pilotes = -($nb_pilotes);
$graph = new Graph($largeur,$hauteur);
$graph->SetScale('linlin',$nb_pilotes,0,0,$nb_tours);
$graph->img->SetAntiAliasing(false);
$graph->SetMargin(170, 20, 40, 30);
$graph->SetMarginColor('white');
$graph->yaxis->SetLabelFormatCallback("_cb_negate");
$graph->yaxis->scale->ticks->Set(1);
$graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,9);
$graph->yaxis->HideZeroLabel();
$graph->xaxis->scale->ticks->Set(1);
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,9);
$graph->xaxis->SetLabelSide(SIDE_UP);
$graph->xgrid->Show();
$lp = array();
for($i=1;$i<=sizeof($tabPilotes);$i++)
{
$lp[$i] = new LinePlot($tabPilotes[$i]['ydata']);
$lp[$i]->SetLegend($tabPilotes[$i]['pilote']);
$graph->Add($lp[$i]);
$lp[$i]->SetWeight(2);
$lp[$i]->SetColor($tabPilotes[$i]['color']);
}
$graph->legend->SetAbsPos(0,55,'left','top');
$graph->legend->SetLayout(LEGEND_VERT);
$graph->legend->SetLineSpacing(15);
$graph->Stroke($filename);
exit; |
Partager