Blame | Last modification | View Log | RSS feed
<?php
include ("../../../../api/jpgraph_1.12.2/jpgraph.php") ;
include ("../../../../api/jpgraph_1.12.2/jpgraph_pie.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;
}
// requĂȘte sur les semaines
$data = array() ;
$legend = array() ;
$requete = "select count(U_ACT) as NBR, LABEL_ACT from annuaire_tela, annuaire_LABEL_ACT where U_ACT<>3 and U_ACT=ID_LABEL_ACT group by LABEL_ACT" ;
$resultat = $db->query($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$data[] = $ligne->NBR ;
$legend[] = $ligne->LABEL_ACT ;
}
$datay = array_values($data) ;
$graph = new PieGraph(500,400,"auto");
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set("Activité professionnelle des inscrits");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->title->SetColor("black");
$graph->legend->Pos(0.1,0.1);
// Create pie plot
$p1 = new PiePlot($datay);
$p1->SetSliceColors(array('red','yellow','seagreen3'));
$p1->SetCenter(0.5,0.6);
$p1->SetLabelType(PIE_VALUE_PER) ;
$p1->value->SetFormat('%d %%') ;
$p1->value->Show();
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->Stroke();
?>