Subversion Repositories Sites.tela-botanica.org

Rev

Details | Last modification | View Log | RSS feed

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