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 "../LinePlot.class.php";
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
$graph = new Graph(400, 200);
|
|
|
14 |
$graph->setAntiAliasing(TRUE);
|
|
|
15 |
|
|
|
16 |
$group = new PlotGroup;
|
|
|
17 |
$group->setXAxisZero(FALSE);
|
|
|
18 |
$group->grid->setType(Line::DASHED);
|
|
|
19 |
|
|
|
20 |
$group->setBackgroundColor(new Color(197, 180, 210, 80));
|
|
|
21 |
|
|
|
22 |
$group->setPadding(40, NULL, 20, NULL);
|
|
|
23 |
|
|
|
24 |
$group->axis->left->setLabelNumber(8);
|
|
|
25 |
$group->axis->left->setLabelPrecision(1);
|
|
|
26 |
$group->axis->left->setTickStyle(Tick::IN);
|
|
|
27 |
$group->axis->left->label->move(-4, 0);
|
|
|
28 |
|
|
|
29 |
$group->axis->bottom->setTickStyle(Tick::OUT);
|
|
|
30 |
$group->axis->bottom->label->move(0, 4);
|
|
|
31 |
|
|
|
32 |
$x = array();
|
|
|
33 |
|
|
|
34 |
for($i = 0; $i < 15; $i++) {
|
|
|
35 |
$x[] = cos($i * M_PI / 5);
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
$plot = new LinePlot($x);
|
|
|
39 |
$plot->setColor(new Color(40, 40, 150, 10));
|
|
|
40 |
$plot->setFillColor(new Color(40, 40, 150, 90));
|
|
|
41 |
|
|
|
42 |
$group->add($plot);
|
|
|
43 |
$group->legend->add($plot, "Ligne #1", Legend::LINE);
|
|
|
44 |
|
|
|
45 |
$x = array();
|
|
|
46 |
|
|
|
47 |
for($i = 5; $i < 15; $i++) {
|
|
|
48 |
$x[] = (cos($i * M_PI / 5)) / 2;
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
$plot = new LinePlot($x);
|
|
|
52 |
$plot->setColor(new Color(120, 120, 30, 10));
|
|
|
53 |
$plot->setFillColor(new Color(120, 120, 30, 90));
|
|
|
54 |
|
|
|
55 |
$group->add($plot);
|
|
|
56 |
$group->legend->add($plot, "Ligne #2", Legend::LINE);
|
|
|
57 |
|
|
|
58 |
$group->legend->setTextFont(new Tuffy(8));
|
|
|
59 |
$group->legend->shadow->setSize(0);
|
|
|
60 |
$group->legend->setSpace(12);
|
|
|
61 |
$group->legend->setBackgroundColor(new Color(255, 255, 255));
|
|
|
62 |
$group->setPadding(NULL, 100, NULL, NULL);
|
|
|
63 |
|
|
|
64 |
$graph->add($group);
|
|
|
65 |
$graph->draw();
|
|
|
66 |
?>
|