Subversion Repositories Sites.tela-botanica.org

Rev

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

// requĂȘte sur les semaines

$data = array() ;

for ($i = 1 ; $i < 3 ; $i++) {
        $requete = "select count(U_ASS) as NBR from annuaire_tela where U_ASS=\"$i\"" ;
        $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 ;
    }
}
$datay = array_values($data) ;

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


// Set A title for the plot
$graph->title->Set("Appartenance a une association");
$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'));

$p1->SetCenter(0.5,0.6);
$p1->SetLabelType(PIE_VALUE_PER) ;
$p1->value->SetFormat('%d %%') ;
$p1->value->Show();

$p1->SetLegends(array("oui", "non"));

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



?>