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(400, 300);
14
$graph->setAntiAliasing(TRUE);
15
 
16
$x = array(
17
	1, 2, 5, 0.5, 3, 8, 7, 6, 2, -4
18
);
19
 
20
$plot = new LinePlot($x);
21
 
22
// Change component padding
23
$plot->setPadding(10, NULL, NULL, NULL);
24
 
25
// Change component space
26
$plot->setSpace(5, 5, 5, 5);
27
 
28
// Set a background color
29
$plot->setBackgroundColor(
30
	new Color(230, 230, 230)
31
);
32
 
33
// Change grid background color
34
$plot->grid->setBackgroundColor(
35
	new Color(235, 235, 180, 60)
36
);
37
 
38
// Hide grid
39
$plot->grid->hide(TRUE);
40
 
41
// Hide labels on Y axis
42
$plot->yAxis->label->hide(TRUE);
43
 
44
$plot->xAxis->label->setInterval(2);
45
 
46
$plot->label->set($x);
47
$plot->label->setFormat('%.1f');
48
$plot->label->setBackgroundColor(new Color(240, 240, 240, 15));
49
$plot->label->border->setColor(new Color(255, 0, 0, 15));
50
$plot->label->setPadding(5, 3, 1, 1);
51
 
52
$plot->xAxis->label->move(0, 5);
53
$plot->xAxis->label->setBackgroundColor(new Color(240, 240, 240, 15));
54
$plot->xAxis->label->border->setColor(new Color(0, 150, 0, 15));
55
$plot->xAxis->label->setPadding(5, 3, 1, 1);
56
 
57
$graph->add($plot);
58
$graph->draw();
59
?>