Subversion Repositories Sites.tela-botanica.org

Rev

Rev 609 | Blame | Compare with Previous | 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&eacute;boguage   : ' . $db->getDebugInfo() . "\n";
    exit;
}

// requête sur les semaines

$data = array() ;
$legend = array() ;

$requete = "SELECT count( U_NIV ) AS NBR, LABEL_NIV
            FROM annuaire_tela, annuaire_LABEL_NIV
            WHERE U_NIV = ID_LABEL_NIV AND U_NIV <>4
            GROUP BY ID_LABEL_NIV " ;
$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 ;
    $legende[] = $ligne->LABEL_NIV;
}
$datay = array_values($data) ;

$graph = new PieGraph(500,400,"auto");
$graph->SetShadow();


// Set A title for the plot
$graph->title->Set("Répartition des inscrits au réseau selon leur niveau en botanique");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->title->SetColor('black');
$graph->legend->Pos(0.04,0.08);

// Create pie plot
$p1 = new PiePlot($datay);
$p1->SetSliceColors(array('yellow','orange','red'));
$p1->SetCenter(0.5,0.6);

$p1->SetLabelType(PIE_VALUE_PER) ;
$p1->value->SetFormat('%d %%') ;
$p1->value->Show();

$p1->SetLegends($legende);

$graph->Add($p1);
$graph->Stroke();



?>