| 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(300, 200);
|
|
|
14 |
|
|
|
15 |
$graph->setAntiAliasing(TRUE);
|
|
|
16 |
|
|
|
17 |
$x = array(
|
|
|
18 |
-4, -5, -2, -8, -3, 1, 4, 9, 5, 6, 2
|
|
|
19 |
);
|
|
|
20 |
|
|
|
21 |
$plot = new LinePlot($x);
|
|
|
22 |
$plot->setStyle(Line::DASHED);
|
|
|
23 |
|
|
|
24 |
$plot->setSpace(4, 4, 10, 0);
|
|
|
25 |
$plot->setPadding(25, 15, 10, 18);
|
|
|
26 |
|
|
|
27 |
$plot->setBackgroundGradient(
|
|
|
28 |
new LinearGradient(
|
|
|
29 |
new Color(230, 230, 230),
|
|
|
30 |
new Color(255, 255, 255),
|
|
|
31 |
90
|
|
|
32 |
)
|
|
|
33 |
);
|
|
|
34 |
|
|
|
35 |
$plot->setFilledArea(7, 9, new Red(25));
|
|
|
36 |
$plot->setFilledArea(1, 4, new Yellow(25));
|
|
|
37 |
|
|
|
38 |
$plot->setColor(new Color(0, 0, 150, 20));
|
|
|
39 |
|
|
|
40 |
$plot->grid->setColor(new VeryLightGray);
|
|
|
41 |
|
|
|
42 |
$plot->mark->setType(Mark::SQUARE);
|
|
|
43 |
$plot->mark->setSize(4);
|
|
|
44 |
$plot->mark->setFill(new VeryDarkGreen(30));
|
|
|
45 |
$plot->mark->border->show();
|
|
|
46 |
$plot->mark->border->setColor(new DarkBlue(60));
|
|
|
47 |
|
|
|
48 |
$plot->xAxis->label->hide(TRUE);
|
|
|
49 |
$plot->xAxis->setNumberByTick('minor', 'major', 3);
|
|
|
50 |
|
|
|
51 |
$plot->yAxis->setLabelNumber(8);
|
|
|
52 |
|
|
|
53 |
$plot->legend->add($plot, "My line");
|
|
|
54 |
$plot->legend->setPosition(0.9, 0.77);
|
|
|
55 |
|
|
|
56 |
$graph->add($plot);
|
|
|
57 |
$graph->draw();
|
|
|
58 |
?>
|