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
| <?php
include ("C:\Users\Joe\Desktop\Projets\Site\jpgraph.php");
include ("C:\Users\Joe\Desktop\Projets\Site\jpgraph_line.php");
$id_connexion = mysql_connect ('127.0.0.1',"root","mysql");
mysql_select_db("test",$id_connexion);
$requete = mysql_query("SELECT y FROM tonne ORDER BY nombre");
$ydata = array($requete);
$xdata = array('JAN','FEV','MAR','AVR','MAI','JUN','JUI','AOU','SEP','OCT','NOV','DEC');
// Creation du graphique
$graph = new Graph(800,600);
$graph->img->SetMargin(40,30,50,40);
$graph->SetScale("textlin");
// Création du système de points
$lineplot=new LinePlot($ydata);
//X names
$graph->xaxis->title->Set("Mois");
$graph->xaxis->SetTickLabels($xdata);
// On rajoute les points au graphique
$graph->Add($lineplot);
// Affichage
$graph->Stroke();
//close le mysql
mysql_close ();
?> |
Partager