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(8));
|
|
|
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.45, 0.45);
|
|
|
23 |
$plot->setCenter($x, $y);
|
|
|
24 |
$plot->set3D(10);
|
|
|
25 |
$plot->setBorderColor(new Color(230, 230, 230));
|
|
|
26 |
|
|
|
27 |
return $plot;
|
|
|
28 |
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
$graph = new Graph(400, 300);
|
|
|
32 |
|
|
|
33 |
$plot = createPie(array(1, 4, 5, 2, 3), "Cowléoptère", 0.22, 0.25);
|
|
|
34 |
$graph->add($plot);
|
|
|
35 |
|
|
|
36 |
$plot = createPie(array(1, 9, 1, 2, 1), "Asticow", 0.68, 0.25);
|
|
|
37 |
$graph->add($plot);
|
|
|
38 |
|
|
|
39 |
$plot = createPie(array(5, 7, 8, 6, 3), "Cowlibri", 0.22, 0.75);
|
|
|
40 |
$graph->add($plot);
|
|
|
41 |
|
|
|
42 |
$plot = createPie(array(6, 4, 6, 5, 6), "Bourricow", 0.68, 0.75);
|
|
|
43 |
$plot->legend->hide(FALSE); // We print only one legend
|
|
|
44 |
$plot->legend->setPosition(1.18, 0);
|
|
|
45 |
$graph->add($plot);
|
|
|
46 |
|
|
|
47 |
$graph->draw();
|
|
|
48 |
?>
|