salut salut,
Je sais pas si tu as trouve mais si cela t'interesse j'y suis arrive !
voici un p'tit exemple avec jpgraph 1.7 php > 4 et ms sql serveur 2000
<?php include ("../jpgraph.php"); include ("../jpgraph_pie.php");
$myServer = "localhost"; $myUser = "sa"; $myPass = "christophe"; $myDB = "asp";
$s = @mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
$d = @mssql_select_db($myDB, $s) or die("Couldn't open database $myDB");
/*requete sql*/ $query = "select nom, age from graphesql order by age"; /* EXECUTION DE LA REQUETE QUERY*/ $result = mssql_query($query);
/*data pour le graphe*/ if ($myrow=mssql_fetch_array($result)) { do { $data[] = $myrow["age"]; //contient les ages $data_names[] = $myrow["nom"]; //contient les noms }while ($myrow=mssql_fetch_array($result)); }
$filename ="Le nom de votre fichier"; $PIE_TITLE ="un test";
// Create the Pie Graph. $graph = new PieGraph(520,400,$filename,60); $graph->SetShadow();
// 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();
?>
voila cela va te creer un graphe en camenbert
si tu veux teste sous mysql change juste les mss...par mysql
ok
ciao
christophe
|