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
|
// mon tableau de couleur pour les 2 types
$colors =array ( 0 => '#006600', 1 => 'red', 2 => '#0066AA', 3 => '#99CC33', 4 => '#FFCC33', );
function genererPieImage($tDonnees,$width, $height,$colors,$titre,$name,$bol=true){
$graph = new PieGraph($width,$height,'auto');
$graph->title->SetFont(FF_GEORGIA,FS_ITALIC);
$graph->SetShadow();
$graph->legend->Pos(0.02,0.06,"right","top");
$graph->title->Set($titre);
$graph->title->SetFont(FF_GEORGIA,FS_ITALIC);
// pour affichage 3D
//$p1 = new PiePlotC($tDonnees[0]);
$p1 = new PiePlot3D($tDonnees[0]);
//$p1->SetTheme("pastel");
$p1->value->SetColor("black","white");
$p1->SetCenter(0.4,0.5);
$p1->setslicecolors($colors);
$p1->SetLegends($tDonnees[1]);
if($bol){
foreach ($tDonnees[0] as $key=>$ele){
$lbl[]=formatMyNumber($ele) . "\n%.1f%%";
}
$p1->SetLabels($lbl,1);
}
for($j=0;$j<count($tDonnees[0]);$j++){
$targ[]="pie_csimex1.php#" . $j;
$alts[]="val=%d";
}
$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d");
$p1->SetCSIMTargets($targ,$alts);
$graph->Add($p1);
$graph->Stroke($name);
} |
Partager