New file |
0,0 → 1,142 |
<?php |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 5.1 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This file is part of tela_botanica_v4. | |
// | | |
// | tela_botanica_v4 is free software; you can redistribute it and/or modify | |
// | it under the terms of the GNU General Public License as published by | |
// | the Free Software Foundation; either version 2 of the License, or | |
// | (at your option) any later version. | |
// | | |
// | tela_botanica_v4 is distributed in the hope that it will be useful, | |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// | GNU General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU General Public License | |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id$ |
/** |
* tela_botanica_v4 - graph_distribution_europe.php |
* |
* Description : |
* |
*@package tela_botanica_v4 |
//Auteur original : |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 1999-2007 |
*@version $Revision$ $Date$ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
// +------------------------------------------------------------------------------------------------------+ |
// | ENTÊTE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
// Inclusion des fichiers jpgraph nécessaires |
include '../../../../api/jpgraph_2.1.4/jpgraph.php'; |
include '../../../../api/jpgraph_2.1.4/jpgraph_pie.php'; |
include '../../../../api/jpgraph_2.1.4/jpgraph_pie3d.php'; |
|
// Inclusion du fichier de configuration de Papyrus |
include '../../../../papyrus/configuration/pap_config.inc.php'; |
|
// Inclusion de la bibliothèque PEAR DB nécessaire |
include 'DB.php'; |
|
// +------------------------------------------------------------------------------------------------------+ |
// | CORPS du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
|
// Connexion à la base de données |
$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éboguage : ' . $db->getDebugInfo() . "\n"; |
exit; |
} |
|
// Initialisation des variables |
$tab_legende_fr = array(); |
$tab_legende_ss_fr = array(); |
$tab_donnees_fr = array() ; |
$tab_donnees_ss_fr = array() ; |
$total_autre = 0; |
|
// Recherche des données |
$requete = 'SELECT CP_ID_Pays, CP_Intitule_pays, COUNT(CP_ID_Pays) AS nbre '. |
'FROM annuaire_tela, carto_PAYS '. |
'WHERE U_COUNTRY = CP_ID_Pays '. |
'AND CP_ID_Continent = 4 '. |
'GROUP BY CP_ID_Pays '. |
'ORDER BY nbre DESC'; |
|
$resultat = $db->query($requete) ; |
|
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) { |
$id = $ligne->CP_ID_Pays; |
$legende_libelle = $ligne->CP_Intitule_pays.' (%1.2f%%)'; |
if ($id != 'fr' && $id != 'FR') { |
$tab_donnees_ss_fr[] = $ligne->nbre; |
$tab_legende_ss_fr[] = $legende_libelle; |
$total_autre += $ligne->nbre; |
} else { |
$tab_donnees_fr[] = $ligne->nbre; |
$tab_legende_fr[] = $legende_libelle; |
} |
} |
$tab_donnees_fr[] = $total_autre; |
$tab_legende_fr[] = 'Autres pays européens (%1.2f%%)'; |
|
//echo '<pre>'.print_r($tab_donnees_ss_fr, true).'</pre>'; |
//echo '<pre>'.print_r($tab_legende, true).'</pre>'; |
|
$graph = new PieGraph(510, 700, 'camembert_distribution_europe.png', 3600); |
|
$graph->SetShadow(); |
$graph->title->Set('Distribution des inscrits en Europe'); |
$graph->title->SetFont(FF_FONT1,FS_BOLD); |
$graph->legend->Pos(0.02, 0.10, 'right', 'top'); |
|
$p1 = new PiePlot($tab_donnees_fr); |
$p1->setStartAngle(180); |
$p1->SetSize(0.15); |
$p1->SetCenter(0.60, 0.15); |
//$p1->SetLegends($tab_legende_fr); |
$p1->SetLabelType(PIE_VALUE_PER); |
//$p1->value->SetFormat('%1.2f%%'); |
$p1->SetLabels($tab_legende_fr); |
//$p1->title->Set('France'); |
$p1->SetLabelPos(1); |
|
$p2 = new PiePlot($tab_donnees_ss_fr); |
$p2->setStartAngle(180); |
$p2->SetSize(0.22); |
$p2->SetCenter(0.60, 0.75); |
//$p2->SetLegends($tab_legende_ss_fr); |
$p2->SetLabelType(PIE_VALUE_PER); |
//$p2->value->SetFormat('%1.2f%%'); |
$p2->SetLabels($tab_legende_ss_fr); |
$p2->title->Set('Détails des "autres pays"'); |
$p2->title->SetMargin(20); |
$p2->SetLabelPos(1); |
|
$graph->Add($p1); |
$graph->Add($p2); |
$graph->Stroke(); |
|
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log$ |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |