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, 175);
|
|
|
14 |
|
|
|
15 |
$graph->setAntiAliasing(TRUE);
|
|
|
16 |
|
|
|
17 |
$x = array(
|
|
|
18 |
4, 3, 1, 0, -2, 1, 3, 2, 3, 5, 4, 1
|
|
|
19 |
);
|
|
|
20 |
|
|
|
21 |
$plot = new LinePlot($x);
|
|
|
22 |
$plot->setXAxisZero(FALSE);
|
|
|
23 |
|
|
|
24 |
$plot->grid->hide(TRUE);
|
|
|
25 |
|
|
|
26 |
$plot->title->set("Using dashed line and legend");
|
|
|
27 |
$plot->title->setFont(new TuffyItalic(9));
|
|
|
28 |
$plot->title->setBackgroundColor(new Color(255, 255, 255, 50));
|
|
|
29 |
$plot->title->setPadding(3, 3, 3, 3);
|
|
|
30 |
$plot->title->move(0, 20);
|
|
|
31 |
|
|
|
32 |
$plot->setSpace(6, 6, 10, 10);
|
|
|
33 |
$plot->setPadding(30, 10, 15, 25);
|
|
|
34 |
|
|
|
35 |
$plot->setBackgroundColor(
|
|
|
36 |
new Color(245, 245, 245)
|
|
|
37 |
);
|
|
|
38 |
|
|
|
39 |
$plot->setStyle(Line::DASHED);
|
|
|
40 |
$plot->setColor(new Color(0, 150, 0, 20));
|
|
|
41 |
|
|
|
42 |
$plot->setFillGradient(
|
|
|
43 |
new LinearGradient(
|
|
|
44 |
new Color(220, 220, 150, 40),
|
|
|
45 |
new Color(255, 255, 210, 30),
|
|
|
46 |
|
|
|
47 |
)
|
|
|
48 |
);
|
|
|
49 |
|
|
|
50 |
$graph->shadow->setSize(4);
|
|
|
51 |
$graph->shadow->setPosition(Shadow::LEFT_BOTTOM);
|
|
|
52 |
$graph->shadow->smooth(TRUE);
|
|
|
53 |
|
|
|
54 |
$plot->legend->add($plot, "Apples");
|
|
|
55 |
$plot->legend->shadow->setSize(0);
|
|
|
56 |
$plot->legend->setAlign(Legend::CENTER, Legend::TOP);
|
|
|
57 |
$plot->legend->setPosition(0.75, 0.60);
|
|
|
58 |
$plot->legend->setTextFont(new Tuffy(8));
|
|
|
59 |
|
|
|
60 |
$graph->add($plot);
|
|
|
61 |
$graph->draw();
|
|
|
62 |
?>
|