1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| <?php
// Appel des Class nécéssairent au à l'affichage du graphique
include("pChart/class/pData.class.php");
include("pChart/class/pDraw.class.php");
// Requete de récupération des données nécéssaire pour la réalisation du graphique
$requete=mysql_query("SELECT coalesce(type, 'Total') as genre, COUNT(distinct type, nom, prenom) FROM membre GROUP BY type with rollup") or die (mysql_error());
// Définition des données du tableau
$DataSet=new pData;
// Définition 1: Le type d'inter
while ($row=mysql_fetch_array($requete))
{
// On ajoute les données correspondant au type d'intervention dans un tableau Pdata
$DataSet->AddPoint($row['type'],"Serie1");
}
// Définition 2: La légende
$DataSet->AddPoint ("Exploitation","Correctif","Serie2");
$DataSet->AddAllSeries();
// On défini la serie 2 (legende) comme axe des abscisses
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialisation du graphique
$Graph=new pChart(400,300);
$Graph->drawFilledRoundedRectangle(7,7,293,193,5,240,240,240);
$Graph->drawRoundedRectangle(5,5,295,195,5,230,230,230);
// Affichage du Graphique
$Graph->setShadowProperties(2,2,200,200,200);
$Graph->drawFlatPieGraphWithShadow($Graph->GetData(),$DataSet->GetDataDescription(),"Serie1","2","Graphique",120,100,60,PIE_PERCENTAGE,10);
$Graph->drawPieLegend(230,15,$DataSet->GetData(),$DataSet->GetDataDescription(),"Serie2","6","Legende",250,250,250);
$Graph->Stroke();
?> |
Partager