60 |
jpm |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
* This work is hereby released into the Public Domain.
|
|
|
4 |
* To view a copy of the public domain dedication,
|
|
|
5 |
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
|
|
6 |
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
|
|
7 |
*
|
|
|
8 |
*/
|
|
|
9 |
|
|
|
10 |
require_once "../../Pie.class.php";
|
|
|
11 |
|
|
|
12 |
function createPie($values, $title, $x, $y) {
|
|
|
13 |
|
|
|
14 |
$plot = new Pie($values, Pie::EARTH);
|
|
|
15 |
$plot->title->set($title);
|
|
|
16 |
$plot->title->setFont(new TuffyBold(9));
|
|
|
17 |
$plot->title->move(NULL, -12);
|
|
|
18 |
|
|
|
19 |
$plot->label->setFont(new Tuffy(7));
|
|
|
20 |
$plot->legend->hide(TRUE);
|
|
|
21 |
$plot->setLabelPosition(5);
|
|
|
22 |
$plot->setSize(0.48, 0.35);
|
|
|
23 |
$plot->setCenter($x, $y);
|
|
|
24 |
$plot->set3D(8);
|
|
|
25 |
$plot->setBorderColor(new White);
|
|
|
26 |
|
|
|
27 |
return $plot;
|
|
|
28 |
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
$graph = new Graph(280, 350);
|
|
|
32 |
$graph->setAntiAliasing(TRUE);
|
|
|
33 |
|
|
|
34 |
$plot = createPie(array(1, 4, 5, 2, 3), "Cowléoptère", 0.25, 0.24);
|
|
|
35 |
$graph->add($plot);
|
|
|
36 |
|
|
|
37 |
$plot = createPie(array(1, 9, 1, 2, 1), "Asticow", 0.75, 0.24);
|
|
|
38 |
$graph->add($plot);
|
|
|
39 |
|
|
|
40 |
$plot = createPie(array(5, 7, 8, 6, 3), "Cowlibri", 0.25, 0.65);
|
|
|
41 |
$graph->add($plot);
|
|
|
42 |
|
|
|
43 |
$plot = createPie(array(6, 4, 6, 5, 6), "Bourricow", 0.75, 0.65);
|
|
|
44 |
$plot->legend->setModel(Legend::MODEL_BOTTOM);
|
|
|
45 |
$plot->setLegend(array('plip', 'plop', 'plap', 'plup', 'plep'));
|
|
|
46 |
$plot->legend->hide(FALSE); // We print only one legend
|
|
|
47 |
$plot->legend->setPosition(0, 1.10);
|
|
|
48 |
$graph->add($plot);
|
|
|
49 |
|
|
|
50 |
$graph->draw();
|
|
|
51 |
?>
|