Go to most recent revision | Blame | Compare with Previous | 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_donnees = array() ;$tps_debut = mktime(0,0,0,1,1);$tps_courrant = $tps_debut;$tps_fin = time();// jour courrant$i = 1;//Requete par moiswhile ($tps_courrant <= $tps_fin) {//$tps_semaine_suivante = $tps_courrant + (7 * 24 * 60 * 60);$tps_mois_suivant = mktime(0,0,0,$i+1,1);//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++] = $resultat->numRows();//echo ' - '.$resultat->numRows().'<br/>';$tps_courrant = $tps_mois_suivant;}//echo '<pre>'.print_r($tab_donnees, true).'</pre>';$tab_donnees = array_values($tab_donnees);$graph = new Graph(500,400,"auto");$graph->img->SetMargin(30,30,30,40);$graph->SetMarginColor("white");$graph->SetScale('textint');$graph->xaxis->SetTickLabels($tab_mois);$graph->SetShadow();$graph->title->Set("Nombre d'inscrits au Réseau au ".date('d-m-Y', $tps_fin));$graph->title->SetFont(FF_FONT1,FS_BOLD);$graph->xaxis->title->Set("Mois depuis le 1er janvier ".date('Y'));$bPlot = new BarPlot($tab_donnees);$bPlot->value->Show();$bPlot->value->SetFormat("%s");$bPlot->SetColor("brown") ;$graph->Add($bPlot);$graph->Stroke();?>