| 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(450, 400);
|
|
|
13 |
|
|
|
14 |
$graph->setAntiAliasing(TRUE);
|
|
|
15 |
|
|
|
16 |
$blue = new Color(0, 0, 200);
|
|
|
17 |
$red = new Color(200, 0, 0);
|
|
|
18 |
|
|
|
19 |
$group = new PlotGroup;
|
|
|
20 |
$group->setBackgroundColor(
|
|
|
21 |
new Color(240, 240, 240)
|
|
|
22 |
);
|
|
|
23 |
$group->setPadding(40, 40);
|
|
|
24 |
|
|
|
25 |
$values = array(12, 5, 20, 32, 15, 4, 16);
|
|
|
26 |
|
|
|
27 |
$plot = new LinePlot($values);
|
|
|
28 |
$plot->setColor($blue);
|
|
|
29 |
$plot->setYAxis(Plot::LEFT);
|
|
|
30 |
|
|
|
31 |
$group->add($plot);
|
|
|
32 |
|
|
|
33 |
$group->axis->left->setColor($blue);
|
|
|
34 |
$group->axis->left->title->set("Blue line");
|
|
|
35 |
|
|
|
36 |
$values = array(6, 12, 14, 2, 11, 5, 21);
|
|
|
37 |
|
|
|
38 |
$plot = new LinePlot($values);
|
|
|
39 |
$plot->setColor($red);
|
|
|
40 |
$plot->setYAxis(Plot::RIGHT);
|
|
|
41 |
|
|
|
42 |
$group->add($plot);
|
|
|
43 |
|
|
|
44 |
$group->axis->right->setColor($red);
|
|
|
45 |
$group->axis->right->title->set("Red line");
|
|
|
46 |
|
|
|
47 |
$graph->add($group);
|
|
|
48 |
$graph->draw();
|
|
|
49 |
?>
|