source: trunk/xgraph/jpgraph/Examples/horizbarex4.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.1 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2// $Id: horizbarex4.php,v 1.4 2002/11/17 23:59:27 aditus Exp $
3require_once ('jpgraph/jpgraph.php');
4require_once ('jpgraph/jpgraph_bar.php');
5
6$datay=array(1992,1993,1995,1996,1997,1998,2001);
7
8// Size of graph
9$width=400;
10$height=500;
11
12// Set the basic parameters of the graph
13$graph = new Graph($width,$height);
14$graph->SetScale('textlin');
15
16$top = 60;
17$bottom = 30;
18$left = 80;
19$right = 30;
20$graph->Set90AndMargin($left,$right,$top,$bottom);
21
22// Nice shadow
23$graph->SetShadow();
24
25// Setup labels
26$lbl = array("Andrew\nTait","Thomas\nAnderssen","Kevin\nSpacey","Nick\nDavidsson",
27"David\nLindquist","Jason\nTait","Lorin\nPersson");
28$graph->xaxis->SetTickLabels($lbl);
29
30// Label align for X-axis
31$graph->xaxis->SetLabelAlign('right','center','right');
32
33// Label align for Y-axis
34$graph->yaxis->SetLabelAlign('center','bottom');
35
36// Titles
37$graph->title->Set('Number of incidents');
38
39// Create a bar pot
40$bplot = new BarPlot($datay);
41$bplot->SetFillColor('orange');
42$bplot->SetWidth(0.5);
43$bplot->SetYMin(1990);
44
45$graph->Add($bplot);
46
47$graph->Stroke();
48?>
Note: See TracBrowser for help on using the repository browser.