Subversion Repositories Sites.tela-botanica.org

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 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
 
12
    echo 'Message Standard         : ' . $db->getMessage() . "\n";
13
    echo 'Message DBMS/Utilisateur : ' . $db->getUserInfo() . "\n";
14
    echo 'Message DBMS/D&eacute;boguage   : ' . $db->getDebugInfo() . "\n";
15
    exit;
16
}
17
 
18
// requĂȘte sur les semaines
19
 
20
$data = array() ;
21
 
22
for ($i = 1 ; $i < 3 ; $i++) {
23
	$requete = "select count(U_ASS) as NBR from annuaire_tela where U_ASS=\"$i\"" ;
24
	$resultat = $db->query($requete) ;
25
    if (DB::isError ($resultat)) {
26
        die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
27
    }
28
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
29
		$data[] = $ligne->NBR ;
30
    }
31
}
32
$datay = array_values($data) ;
33
 
34
$graph = new PieGraph(500,400,"auto");
35
$graph->SetShadow();
36
 
37
 
38
// Set A title for the plot
39
$graph->title->Set("Appartenance a une association");
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
$p1->SetSliceColors(array('red','yellow'));
47
 
48
$p1->SetCenter(0.5,0.6);
49
$p1->SetLabelType(PIE_VALUE_PER) ;
50
$p1->value->SetFormat('%d %%') ;
51
$p1->value->Show();
52
 
53
$p1->SetLegends(array("oui", "non"));
54
 
55
$graph->Add($p1);
56
$graph->Stroke();
57
 
58
 
59
 
60
?>