source: trunk/xgraph/jpgraph/Examples/example23.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
5setlocale (LC_ALL, 'et_EE.ISO-8859-1');
6
7$data1y=array(12,8,19,3,10,5);
8$data2y=array(8,2,11,7,14,4);
9
10// Create the graph. These two calls are always required
11$graph = new Graph(310,200);   
12$graph->SetScale("textlin");
13
14$graph->SetShadow();
15$graph->img->SetMargin(40,30,20,40);
16
17// Create the bar plots
18$b1plot = new BarPlot($data1y);
19$b1plot->SetFillColor("orange");
20$b2plot = new BarPlot($data2y);
21$b2plot->SetFillColor("blue");
22
23// Create the grouped bar plot
24$gbplot = new AccBarPlot(array($b1plot,$b2plot));
25
26// ...and add it to the graPH
27$graph->Add($gbplot);
28
29$graph->title->Set("Accumulated bar plots");
30$graph->xaxis->title->Set("X-title");
31$graph->yaxis->title->Set("Y-title");
32
33$graph->title->SetFont(FF_FONT1,FS_BOLD);
34$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
35$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
36
37// Display the graph
38$graph->Stroke();
39?>
Note: See TracBrowser for help on using the repository browser.