| 12
 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
 43
 
 | <?php
include ("C:\Users\Joe\Desktop\Projets\Site\jpgraph.php");
include ("C:\Users\Joe\Desktop\Projets\Site\jpgraph_line.php");
 
//acces à la base de données
$id_connexion = mysql_connect ('127.0.0.1',"root","mysql"); 
mysql_select_db("test",$id_connexion);
$o = 2008;
//requête
$requete = mysql_query("SELECT y FROM tonne where Mois between 1 and 12 and Annee = $o") or die('Pb de requête');
//$donnees = mysql_fetch_array($requete);
while ($donnees = mysql_fetch_array($requete))
{
$y[] = $donnees ['y'];
 
//$ydata = array();
}
$ydata = array ('0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' );
$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($y);
//X names
$graph->xaxis->title->Set("Mois");
$graph->xaxis->SetTickLabels($xdata);
// On rajoute les points au graphique
$graph->title->Set("Graphique : tonnes recyclées en $o");
$graph->Add($lineplot);
 
 
// Affichage
$graph->Stroke();
 
//close le mysql
 
mysql_close ();
 
?> | 
Partager