Subversion Repositories Sites.tela-botanica.org

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 david 1
<?php
2
 
3
include ("../../../../api/jpgraph_1.12.2/jpgraph.php") ;
4
include ("../../../../api/jpgraph_1.12.2/jpgraph_pie.php");
5
include ("../../../../papyrus/configuration/pap_config.inc.php") ;
6
include_once 'DB.php' ;
7
 
8
 
9
$db = DB::connect (PAP_DSN) ;
10
 
11
if (DB::isError($db)) {
12
 
13
    echo 'Message Standard         : ' . $db->getMessage() . "\n";
14
    echo 'Message DBMS/Utilisateur : ' . $db->getUserInfo() . "\n";
15
    echo 'Message DBMS/D&eacute;boguage   : ' . $db->getDebugInfo() . "\n";
16
    exit;
17
}
18
 
19
// requête sur les semaines
20
 
21
$data = array() ;
22
$legend = array() ;
23
 
24
$requete = "SELECT count( U_NIV ) AS NBR, LABEL_NIV
25
            FROM annuaire_tela, annuaire_LABEL_NIV
26
            WHERE U_NIV = ID_LABEL_NIV AND U_NIV <>4
27
            GROUP BY ID_LABEL_NIV " ;
28
$resultat = $db->query($requete) ;
29
if (DB::isError ($resultat)) {
30
    die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
31
}
32
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
33
    $data[] = $ligne->NBR ;
34
    $legende[] = $ligne->LABEL_NIV;
35
}
36
$datay = array_values($data) ;
37
 
38
$graph = new PieGraph(500,400,"auto");
39
$graph->SetShadow();
40
 
41
 
42
// Set A title for the plot
43
$graph->title->Set("Répartition des inscrits au réseau selon leur niveau en botanique");
44
$graph->title->SetFont(FF_FONT1,FS_BOLD);
45
$graph->title->SetColor('black');
46
$graph->legend->Pos(0.04,0.08);
47
 
48
// Create pie plot
49
$p1 = new PiePlot($datay);
50
$p1->SetSliceColors(array('yellow','orange','red'));
51
$p1->SetCenter(0.5,0.6);
52
 
53
$p1->SetLabelType(PIE_VALUE_PER) ;
54
$p1->value->SetFormat('%d %%') ;
55
$p1->value->Show();
56
 
57
$p1->SetLegends($legende);
58
 
59
$graph->Add($p1);
60
$graph->Stroke();
61
 
62
 
63
 
64
?>