source: trunk/xgraph/jpgraph/Examples/example25.1.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.0 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_bar.php');
4
5$datay=array(12,8,19,3,10,5);
6
7// Create the graph. These two calls are always required
8$graph = new Graph(300,200);
9$graph->SetScale('textlin');
10
11// Add a drop shadow
12$graph->SetShadow();
13
14// Adjust the margin a bit to make more room for titles
15$graph->img->SetMargin(40,30,40,40);
16
17// Create a bar pot
18$bplot = new BarPlot($datay);
19$graph->Add($bplot);
20
21// Create and add a new text
22$txt=new Text('This is a text');
23$txt->SetPos(10,20);
24$txt->SetColor('darkred');
25$txt->SetFont(FF_FONT2,FS_BOLD);
26$txt->SetBox('yellow','navy','gray@0.5');
27$graph->AddText($txt);
28
29// Setup the titles
30$graph->title->Set("A simple bar graph");
31$graph->xaxis->title->Set("X-title");
32$graph->yaxis->title->Set("Y-title");
33
34$graph->title->SetFont(FF_FONT1,FS_BOLD);
35$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
36$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
37
38// Display the graph
39$graph->Stroke();
40?>
Note: See TracBrowser for help on using the repository browser.