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 |
// Use cache
|
|
|
14 |
$graph = new Graph(400, 400);
|
|
|
15 |
$graph->setAntiAliasing(TRUE);
|
|
|
16 |
$graph->border->setStyle(Line::DOTTED);
|
|
|
17 |
$graph->border->setColor(new Red);
|
|
|
18 |
|
|
|
19 |
$x = array();
|
|
|
20 |
for($i = 0; $i < 10; $i++) {
|
|
|
21 |
$x[] = mt_rand(20, 100);
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
$plot = new LinePlot($x);
|
|
|
25 |
$plot->setFilledArea(0, 1, new Red(40));
|
|
|
26 |
$plot->setFilledArea(1, 2, new LinearGradient(new Red(40), new Orange(40), 90));
|
|
|
27 |
$plot->setFilledArea(2, 4, new LinearGradient(new Orange(40), new Green(40), 90));
|
|
|
28 |
$plot->setFilledArea(4, 7, new LinearGradient(new Green(40), new Blue(40), 90));
|
|
|
29 |
$plot->setFilledArea(7, 8, new LinearGradient(new Blue(40), new Purple(40), 90));
|
|
|
30 |
$plot->setFilledArea(8, 9, new Purple(40));
|
|
|
31 |
|
|
|
32 |
$graph->add($plot);
|
|
|
33 |
$graph->draw();
|
|
|
34 |
?>
|