Blame | Last modification | View Log | RSS feed
<?phpinclude ("../../../../api/jpgraph_1.12.2/jpgraph.php") ;include ("../../../../api/jpgraph_1.12.2/jpgraph_line.php") ;include ("../../../../api/jpgraph_1.12.2/jpgraph_bar.php");include ("../../../../papyrus/configuration/pap_config.inc.php") ;include_once 'DB.php' ;$db = DB::connect (PAP_DSN) ;if (DB::isError($db)) {echo 'Message Standard : ' . $db->getMessage() . "\n";echo 'Message DBMS/Utilisateur : ' . $db->getUserInfo() . "\n";echo 'Message DBMS/Déboguage : ' . $db->getDebugInfo() . "\n";exit;}$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Août","Sep","Oct","Nov","Dec");$tab_legende = array('');$tab_donnees = array(0) ;$annee_debut = 2002;$mois = 4;$annee = 2002;$tps_debut = mktime(0,0,0,$mois,1,$annee);$tps_courrant = $tps_debut;$tps_fin = time();// jour courrant//Requete par mois$i = 1;while ($tps_courrant <= $tps_fin) {if (($mois)/12 > 1) {$mois = 1;$annee = $annee+1;}$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);//echo date('Y-m-d H:i:s', $tps_courrant).' - '.date('Y-m-d H:i:s', $tps_mois_suivant);$requete = 'SELECT U_DATE '.'FROM annuaire_tela '.'WHERE U_DATE >= "'.date('Y-m-d H:i:s', $tps_courrant).'" '.'AND U_DATE < "'.date('Y-m-d H:i:s', $tps_mois_suivant).'" ';$resultat = $db->query($requete) ;$tab_donnees[$i] = $tab_donnees[$i-1] + $resultat->numRows();//echo ' - '.$resultat->numRows().'<br/>';$tps_courrant = $tps_mois_suivant;$tab_legende[$i] = $tab_mois[$mois-1].' '.$annee;$mois++;$i++;}//echo '<pre>'.print_r($tab_donnees, true).'</pre>';$graph = new Graph(500,490,"auto");$graph->img->SetMargin(50,30,50,100);$graph->SetMarginColor("white");$graph->SetScale('textint');$graph->xaxis->SetTickLabels($tab_legende);$graph->xaxis->SetLabelAngle(90);$graph->xaxis->SetTextLabelInterval(4);$graph->SetShadow();$graph->title->Set("Évolution des inscrits au Réseau au ".date('d-m-Y', $tps_fin));$graph->title->SetFont(FF_FONT1,FS_BOLD);$txt = new Text('Mois depuis le 1er avril 2002',270,460);$graph->AddText($txt);$LinePlot = new LinePlot($tab_donnees);$LinePlot->SetColor("brown") ;$graph->Add($LinePlot);$graph->Stroke();?>