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
| ....
$effectifhomme=creertableau('prod2',$superrequete1,2);
$effectiffemme=creertableau('prod2',$superrequete2,2);
$age=creertableau('prod2',$superrequete2,1);
$graphique = new Graph(600,400,"auto");
$graphique->img->SetMargin(50,50,100,50);
$graphique->title->Set("-- Effectif des Ages Hommes-Femmes chez Gedimat --");
$graphique->SetScale("textlin");
$graphique->SetMarginColor('white');
// instance de la classe LinePlot, la variable $lineplot est affectée par l'objet créé
// ce lineplot contient les points définis dans le tableau $ydonnees
$lineplot = new LinePlot($effectifhomme);
$lineplot2 = new LinePlot($effectiffemme);
// cette méthode définit la couleur de la ligne du lineplot
$lineplot->SetColor("blue");
$lineplot->SetLegend('Hommes');
$lineplot2->SetColor("red");
$lineplot2->SetLegend('Femmes');
//*******************************AXE DES ABSCISSES
$graphique->xaxis->SetTextLabelInterval(10);
$graphique->xaxis->title->Set("Age");
$graphique->xaxis->SetTickLabels($age);
//$graphique->xaxis->SetTextTickInterval(10,0);
//****************************AXE DES ORDONNEES
//$graphique->yaxis->SetTextLabelInterval(100);
$graphique->yaxis->title->Set("Effectif");
//$graphique->yaxis->SetTickLabels($effectifhomme);
// ajoute le lineplot dans le graphique
$graphique->Add($lineplot);
$graphique->AddY2($lineplot2);
// ajout du 2 axe des ordonnees
$graphique->SetY2Scale( "lin");
// trace the graphique
$graphique->Stroke();
?> |
Partager