source: trunk/xgraph/jpgraph/Examples/example22.php

Last change on this file was 42, checked in by marrucho, 10 years ago
File size: 1019 bytes
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_bar.php');
4
5$data1y=array(12,8,19,3,10,5);
6$data2y=array(8,2,11,7,14,4);
7
8// Create the graph. These two calls are always required
9$graph = new Graph(310,200);   
10$graph->SetScale("textlin");
11$graph->SetShadow();
12
13$graph->img->SetMargin(40,30,20,40);
14
15// Create the bar plots
16$b1plot = new BarPlot($data1y);
17$b1plot->SetFillColor("orange");
18$b2plot = new BarPlot($data2y);
19$b2plot->SetFillColor("blue");
20
21// Create the grouped bar plot
22$gbplot = new GroupBarPlot(array($b1plot,$b2plot));
23$gbplot->SetWidth(0.9);
24
25// ...and add it to the graPH
26$graph->Add($gbplot);
27
28$graph->title->Set("Adjusting the width");
29$graph->xaxis->title->Set("X-title");
30$graph->yaxis->title->Set("Y-title");
31
32$graph->title->SetFont(FF_FONT1,FS_BOLD);
33$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
34$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
35
36// Display the graph
37$graph->Stroke();
38?>
Note: See TracBrowser for help on using the repository browser.