Salut,
J`essaye de faire des graphiques pour editer des stats a partir de ma BD MySQL, et on ma dit d`utiliser JPGRAPH(car super facile d`utilisation!!....pas pour moi en tout cas! ;-)
Bon, grace a un copier-coller(d`un script php trouver sur un forum), j`arrive a afficher un graphique. MAIS comment faire pour en afficher plusieurs sur la meme page??
Voila mon code ki permet l`affichage d`un graphique:
<?
include("config.php");
include ( "./JPGRAPH/src/jpgraph.php");
include ("./JPGRAPH/src/jpgraph_pie.php");
//include ("./JPGRAPH/src/jpgraph_line.php");
$SQL = "SELECT count(id_cr), status FROM cr_status GROUP BY status";
$RESULT = mysql_query($SQL);
if ($myrow=mysql_fetch_array($RESULT)) {
do {
$data[] = $myrow[0]; //It would not create the graphs without using '[]'
$data_names[] = $myrow[1]."(".$myrow[0].")";
}while ($myrow=mysql_fetch_array($RESULT));
}
// Create the Pie Graph.
$graph = new PieGraph(520,400,$filename,60);
$graph->SetShadow();
$PIE_TITLE="Graphique of the status of the CR";
// Set A title for the plot
$graph->title->Set($PIE_TITLE);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
// Create
$p1 = new PiePlot($data);
$p1->SetCenter(0.35,0.5);
$p1->SetLegends($data_names);
$p1->SetTheme("earth");
$graph->Add($p1);
$graph->Stroke();
?>
Si qqun peut m`aider ca serait cool, Merci
