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
require_once "../../BarPlot.class.php";
12
 
13
 
14
 
15
$graph = new Graph(600, 250);
16
 
17
$graph->setBackgroundColor(new Color(0xF4, 0xF4, 0xF4));
18
$graph->shadow->setSize(3);
19
 
20
$graph->title->set("Evolution");
21
$graph->title->setFont(new Tuffy(15));
22
$graph->title->setColor(new Color(0x00, 0x00, 0x8B));
23
 
24
 
25
$group = new PlotGroup;
26
$group->setSize(0.82, 1);
27
$group->setCenter(0.41, 0.5);
28
$group->setPadding(35, 26, 40, 27);
29
$group->setSpace(2, 2);
30
 
31
$group->grid->setColor(new Color(0xC4, 0xC4, 0xC4));
32
$group->grid->setType(Line::DASHED);
33
$group->grid->hideVertical(TRUE);
34
$group->grid->setBackgroundColor(new White);
35
 
36
$group->axis->left->setColor(new DarkGreen);
37
$group->axis->left->label->setFont(new Font2);
38
 
39
$group->axis->right->setColor(new DarkBlue);
40
$group->axis->right->label->setFont(new Font2);
41
 
42
$group->axis->bottom->label->setFont(new Font2);
43
 
44
$group->legend->setPosition(1.18);
45
$group->legend->setTextFont(new Tuffy(8));
46
$group->legend->setSpace(10);
47
 
48
// Add a bar plot
49
$x = array(16, 16, 12, 13, 11, 18, 10, 12, 11, 12, 11, 16);
50
 
51
$plot = new BarPlot($x, 1, 2);
52
$plot->setBarColor(new MidYellow);
53
$plot->setBarPadding(0.15, 0.15);
54
$plot->barShadow->setSize(3);
55
$plot->barShadow->smooth(TRUE);
56
$plot->barShadow->setColor(new Color(200, 200, 200, 10));
57
$plot->move(1, 0);
58
 
59
$group->legend->add($plot, "Yellow bar", Legend::BACKGROUND);
60
$group->add($plot);
61
 
62
// Add a bar plot
63
$x = array(20, 25, 20, 18, 16, 25, 29, 12, 15, 18, 21, 26);
64
 
65
$plot = new BarPlot($x, 2, 2);
66
$plot->setBarColor(new Color(120, 175, 80, 10));
67
$plot->setBarPadding(0.15, 0.15);
68
$plot->barShadow->setSize(3);
69
$plot->barShadow->smooth(TRUE);
70
$plot->barShadow->setColor(new Color(200, 200, 200, 10));
71
 
72
$group->legend->add($plot, "Green bar", Legend::BACKGROUND);
73
$group->add($plot);
74
 
75
// Add a second bar plot
76
$x = array(12, 14, 10, 9, 10, 16, 12, 8, 8, 10, 12, 13);
77
 
78
$plot = new BarPlot($x, 2, 2);
79
$plot->setBarColor(new Orange);
80
$plot->setBarPadding(0.15, 0.15);
81
 
82
$group->legend->add($plot, "Orange bar", Legend::BACKGROUND);
83
$group->add($plot);
84
 
85
// Add a line plot
86
$x = array(6, 5, 6, 5.5, 4.5, 4, 4.5, 4, 5, 4, 5, 5.5);
87
 
88
$plot = new LinePlot($x, LinePlot::MIDDLE);
89
$plot->setColor(new DarkBlue);
90
$plot->setThickness(5);
91
$plot->setYAxis(Plot::RIGHT);
92
$plot->setYMax(12);
93
 
94
$plot->mark->setType(Mark::CIRCLE);
95
$plot->mark->setSize(6);
96
$plot->mark->setFill(new LightBlue);
97
$plot->mark->border->show();
98
 
99
$group->legend->add($plot, "Blue line", Legend::MARK);
100
$group->add($plot);
101
 
102
$graph->add($group);
103
$graph->draw();
104
?>