| 1 |
lars |
1 |
<?php
|
|
|
2 |
include ("../jpgraph.php");
|
|
|
3 |
include ("../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,"auto");
|
|
|
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 |
?>
|