Bonjour,
J'ai déjà donné une réponse si dessus:
Voici un exemple Pie 19
:
Voici le code du pie 19:
<?php
/*
* This work is hereby released into the Public Domain.
* To view a copy of the public domain dedication,
* visit [
creativecommons.org] or send a letter to
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
*
*/
require_once "../Pie.class.php";
$graph = new Graph(400, 250);
$graph->setAntiAliasing(TRUE);
$graph->title->border->show();
$graph->title->setBackgroundColor(new LightRed(60));
$graph->title->setPadding(3, 3, 3, 3);
$values = array(53.06, 12.25, 8.08, 6.98, 4.89, 3.68, 2.92, 2.48, 2.12, 1.76, 0.9, 0.8);
$colors = array(
new Color(190, 86, 86, 12),
new Color(180, 100, 143, 12),
new Color(210, 148, 202, 12),
new Color(139, 63, 182, 12),
new Color(102, 100, 180, 12),
new Color(100, 179, 180, 12),
new Color(84, 135, 84, 12),
new Color(140, 180, 100, 12),
new Color(114, 206, 138, 12),
//new Color(151, 100, 180, 12),
new Color(180, 173, 100, 12),
new Color(180, 132, 100, 12),
new LightPink
);
$plot = new Pie($values, $colors);
$plot->setSize(0.70, 0.60);
$plot->setCenter(0.33, 0.55);
$plot->set3D(10);
$plot->setBorderColor(new LightGray);
$plot->setLegend(array(
'Legende 1',
'Legende 2',
'Legende 3',
'Legende 4',
'Legende 5',
'Legende 6',
'Legende 7',
'Legende 8',
'Legende 9',
'Legende 10',
'Legende 11',
'Legende 12'
));
$plot->legend->setPosition(1.40);
$graph->add($plot);
$graph->draw();
?>
Si le code ne fonction pas de pie 19 avec artichow, tu dois modifié la classe Pie.class.php.
Il suffit d'ajouter ceci :
if($value/$sum < 0.01)
{
$value=$sum*0.005; // Le minimum
}
dans le fichier Pie.class.php
Comme ceci:
foreach($this->values as $key => $value) {
if($value/$sum < 0.01)
{
$value=$sum*0.005;// Le minimum
}
$angle = ($value / $sum * 360);
if($key === $count - 1) {
$angle = 360 - $angles;
}
Message édité 1 fois. Dernière modification le le 02/07/10 à 14:42