Subversion Repositories Applications.gtt

Rev

Rev 61 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
$group = new PlotGroup;
18
$group->grid->setType(Line::DASHED);
19
 
20
$group->setPadding(40, NULL, 20, NULL);
21
 
22
$group->axis->left->setLabelNumber(8);
23
$group->axis->left->setLabelPrecision(1);
24
$group->axis->left->setTickStyle(Tick::OUT);
25
 
26
$x = array(2, 4, 8, 16, 32, 48, 56, 60, 62);
27
 
28
$plot = new LinePlot($x);
29
$plot->setColor(new Orange());
30
$plot->setFillColor(new LightOrange(80));
31
 
32
$plot->mark->setType(Mark::CIRCLE);
33
$plot->mark->setFill(new MidRed);
34
$plot->mark->setSize(6);
35
 
36
$group->legend->add($plot, "John", Legend::MARK);
37
$group->add($plot);
38
 
39
$x = array(NULL, NULL, NULL, 10, 12, 14, 18, 26, 42);
40
 
41
$plot = new LinePlot($x);
42
$plot->setColor(new Color(120, 120, 30, 10));
43
$plot->setFillColor(new Color(120, 120, 60, 90));
44
 
45
$plot->mark->setType(Mark::SQUARE);
46
$plot->mark->setFill(new DarkGreen);
47
$plot->mark->setSize(5);
48
 
49
$group->add($plot);
50
 
51
function setYear($value) {
52
	return $value + 2000;
53
}
54
 
55
$group->axis->bottom->label->setCallbackFunction('setYear');
56
 
57
function setK($value) {
58
	return round($value).'K';
59
}
60
 
61
$group->axis->left->label->setCallbackFunction('setK');
62
 
63
$group->legend->add($plot, "George", Legend::MARK);
64
$group->legend->setPosition(0.45, 0.25);
65
$group->legend->shadow->smooth(TRUE);
66
 
67
$graph->add($group);
68
 
69
$graph->draw();
70
?>