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 |
$graph = new Graph(280, 200);
|
|
|
13 |
|
|
|
14 |
$x = array();
|
|
|
15 |
for($i = 115; $i < 115 + 180; $i++) {
|
|
|
16 |
$x[] = cos($i / 25);
|
|
|
17 |
}
|
|
|
18 |
|
|
|
19 |
function format($value) {
|
|
|
20 |
return sprintf("%.1f", $value).' %';
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
$plot = new LinePlot($x);
|
|
|
24 |
|
|
|
25 |
$plot->setBackgroundColor(
|
|
|
26 |
new Color(240, 240, 240)
|
|
|
27 |
);
|
|
|
28 |
|
|
|
29 |
$plot->setPadding(40, 15, 15, 15);
|
|
|
30 |
|
|
|
31 |
$plot->setColor(
|
|
|
32 |
new Color(60, 60, 150)
|
|
|
33 |
);
|
|
|
34 |
|
|
|
35 |
$plot->setFillColor(
|
|
|
36 |
new Color(120, 175, 80, 47)
|
|
|
37 |
);
|
|
|
38 |
|
|
|
39 |
$plot->grid->setType(Line::DASHED);
|
|
|
40 |
|
|
|
41 |
$plot->yAxis->setLabelNumber(6);
|
|
|
42 |
$plot->yAxis->setLabelPrecision(1);
|
|
|
43 |
$plot->yAxis->setNumberByTick('minor', 'major', 1);
|
|
|
44 |
$plot->yAxis->label->setCallbackFunction('format');
|
|
|
45 |
$plot->yAxis->label->setFont(new Tuffy(7));
|
|
|
46 |
|
|
|
47 |
$plot->xAxis->setNumberByTick('minor', 'major', 3);
|
|
|
48 |
$plot->xAxis->label->hideFirst(TRUE);
|
|
|
49 |
$plot->xAxis->setLabelInterval(50);
|
|
|
50 |
$plot->xAxis->label->setFont(new Tuffy(7));
|
|
|
51 |
|
|
|
52 |
$plot->grid->setInterval(1, 50);
|
|
|
53 |
|
|
|
54 |
$graph->shadow->setSize(4);
|
|
|
55 |
$graph->shadow->setPosition(Shadow::RIGHT_BOTTOM);
|
|
|
56 |
$graph->shadow->smooth(TRUE);
|
|
|
57 |
|
|
|
58 |
$plot->label->set($x);
|
|
|
59 |
$plot->label->setInterval(25);
|
|
|
60 |
$plot->label->hideFirst(TRUE);
|
|
|
61 |
$plot->label->setPadding(1, 1, 1, 1);
|
|
|
62 |
$plot->label->setCallbackFunction('format');
|
|
|
63 |
$plot->label->setBackgroundColor(
|
|
|
64 |
new Color(227, 223, 241, 15)
|
|
|
65 |
);
|
|
|
66 |
$plot->label->setFont(new Tuffy(7));
|
|
|
67 |
|
|
|
68 |
$graph->add($plot);
|
|
|
69 |
$graph->draw();
|
|
|
70 |
?>
|