source: trunk/xgraph/jpgraph/Examples/example20.4.php

Last change on this file was 42, checked in by marrucho, 10 years ago
File size: 1.1 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$graph->yaxis->scale->SetGrace(20);
11
12// Add a drop shadow
13$graph->SetShadow();
14
15// Adjust the margin a bit to make more room for titles
16$graph->img->SetMargin(40,30,20,40);
17
18// Create a bar pot
19$bplot = new BarPlot($datay);
20
21// Adjust fill color
22$bplot->SetFillColor('orange');
23$bplot->SetShadow();
24$bplot->value->Show();
25$bplot->value->SetFont(FF_ARIAL,FS_BOLD,10);
26$bplot->value->SetAngle(45);
27$bplot->value->SetFormat('%0.1f');
28$graph->Add($bplot);
29
30// Setup the titles
31$graph->title->Set("Bar graph with drop shadow");
32$graph->xaxis->title->Set("X-title");
33$graph->yaxis->title->Set("Y-title");
34
35$graph->title->SetFont(FF_FONT1,FS_BOLD);
36$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
37$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
38
39// Display the graph
40$graph->Stroke();
41?>
Note: See TracBrowser for help on using the repository browser.