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 55 56 57 58 59 60 61 62 63 64 65
| <?php
require_once "Artichow-php4+5/Pie.class.php";
$pourcentage = isset($_GET['pourcentage']) ? $_GET['pourcentage'] : $pourcentage;
$budgetEnCours = isset($_GET['budget_encours']) ? $_GET['budget_encours'] : $budgetEnCours;
$budgetTotal = isset($_GET['budget_total']) ? $_GET['budget_total'] : $budgetTotal;
$graph = new Graph(300, 280);
$graph->setAntiAliasing(TRUE);
// Titre du graph :
$graph->title->set("Secteur / Budget total");
$graph->title->setFont(new Tuffy(14));
// Ombrage du graph :
$graph->shadow->setSize(3);
$graph->shadow->setColor(new Color(0xB4, 0xB4, 0xB4));
// Valeurs :
$reste = 100 - $pourcentage;
$pourcentage = number_format($pourcentage, 2, '.', ' ');
$reste = number_format($reste, 2, '.', ' ');
$values = array($pourcentage, $reste);
$colors = array(new Color(0xA6, 0x05, 0x05), new Color(0x68, 0xCE, 0x1E));
$plot = new Pie($values, $colors);
$plot->setCenter(0.55, 0.42);
$plot->setSize(0.65, 0.55);
// Mode 3D : 9px sur l'axe z :
$plot->set3D(9);
$plot->explode(array(1 => 10));
$plot->label->set($values);
$plot->label->setFont(new Tuffy(9));
$plot->setLabelPosition(9);
// Légende :
$plot->setLegend(array(
'Budget en cours : '.$budgetEnCours,
'Budget total : '.$budgetTotal
));
// On souhaite afficher uniquement l'étiquette concernant le budhet en cours :
$plot->setLabelNumber(1);
// Positionnement des étiquettes :
$plot->legend->setPosition(1.15, 1.3);
// Typo des étiquettes :
$plot->legend->setTextFont(new Tuffy(9));
// Eloignement des étiquettes par rapport au centre :
$plot->legend->setSpace(11);
// Lissage de l'ombres de la légende :
$plot->legend->shadow->smooth(TRUE);
// Nombre de lignes de la légende :
$plot->legend->setRows(2);
$graph->add($plot);
if(isset($_GET['htmlView'])
$graph->draw();
else
$graph->draw('monimage.jpg');
?> |
Partager