| 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 "../../BarPlot.class.php";
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
$graph = new Graph(280, 200);
|
|
|
14 |
|
|
|
15 |
$graph->setAntiAliasing(TRUE);
|
|
|
16 |
|
|
|
17 |
$x = array(
|
|
|
18 |
1, 2, 5, 0.5, 3, 8, 6
|
|
|
19 |
);
|
|
|
20 |
|
|
|
21 |
$plot = new BarPlot($x);
|
|
|
22 |
|
|
|
23 |
$plot->setSpace(4, 4, 10, 0);
|
|
|
24 |
$plot->setPadding(40, 15, 10, 40);
|
|
|
25 |
|
|
|
26 |
$plot->title->set("Zoé and friends");
|
|
|
27 |
$plot->title->setFont(new TuffyBold(11));
|
|
|
28 |
$plot->title->border->show();
|
|
|
29 |
$plot->title->setBackgroundColor(new Color(255, 255, 255, 25));
|
|
|
30 |
$plot->title->setPadding(4, 4, 4, 4);
|
|
|
31 |
$plot->title->move(-20, 25);
|
|
|
32 |
|
|
|
33 |
$plot->yAxis->title->set("Axe des Y");
|
|
|
34 |
$plot->yAxis->title->setFont(new TuffyBold(10));
|
|
|
35 |
$plot->yAxis->title->move(-4, 0);
|
|
|
36 |
$plot->yAxis->setTitleAlignment(Label::TOP);
|
|
|
37 |
|
|
|
38 |
$plot->xAxis->title->set("Axe des X");
|
|
|
39 |
$plot->xAxis->title->setFont(new TuffyBold(10));
|
|
|
40 |
$plot->xAxis->setTitleAlignment(Label::RIGHT);
|
|
|
41 |
|
|
|
42 |
$plot->setBackgroundGradient(
|
|
|
43 |
new LinearGradient(
|
|
|
44 |
new Color(230, 230, 230),
|
|
|
45 |
new Color(255, 255, 255),
|
|
|
46 |
|
|
|
47 |
)
|
|
|
48 |
);
|
|
|
49 |
|
|
|
50 |
$plot->barBorder->setColor(new Color(0, 0, 150, 20));
|
|
|
51 |
|
|
|
52 |
$plot->setBarGradient(
|
|
|
53 |
new LinearGradient(
|
|
|
54 |
new Color(150, 150, 210, 0),
|
|
|
55 |
new Color(230, 230, 255, 30),
|
|
|
56 |
|
|
|
57 |
)
|
|
|
58 |
);
|
|
|
59 |
|
|
|
60 |
$y = array(
|
|
|
61 |
'Zoé',
|
|
|
62 |
'Yvan',
|
|
|
63 |
'Fred',
|
|
|
64 |
'Lucie',
|
|
|
65 |
'Ilia',
|
|
|
66 |
'Nino',
|
|
|
67 |
'Marie'
|
|
|
68 |
);
|
|
|
69 |
|
|
|
70 |
$plot->xAxis->setLabelText($y);
|
|
|
71 |
$plot->xAxis->label->setFont(new TuffyBold(7));
|
|
|
72 |
|
|
|
73 |
$graph->shadow->setSize(4);
|
|
|
74 |
$graph->shadow->setPosition(Shadow::LEFT_TOP);
|
|
|
75 |
$graph->shadow->smooth(TRUE);
|
|
|
76 |
$graph->shadow->setColor(new Color(160, 160, 160));
|
|
|
77 |
|
|
|
78 |
$graph->add($plot);
|
|
|
79 |
$graph->draw();
|
|
|
80 |
?>
|