Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
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
$data3y=array(3,9,2,7,5,8);
8
$data4y=array(1,5,11,2,14,4);
9
 
10
// Create the graph. These two calls are always required
11
$graph = new Graph(310,200,"auto");
12
$graph->SetScale("textlin");
13
 
14
$graph->SetShadow();
15
$graph->img->SetMargin(40,30,20,40);
16
 
17
$b1plot = new BarPlot($data1y);
18
$b1plot->SetFillColor("orange");
19
$b2plot = new BarPlot($data2y);
20
$b2plot->SetFillColor("blue");
21
$b3plot = new BarPlot($data3y);
22
$b3plot->SetFillColor("green");
23
$b4plot = new BarPlot($data4y);
24
$b4plot->SetFillColor("brown");
25
 
26
// Create the accumulated bar plots
27
$ab1plot = new AccBarPlot(array($b1plot,$b2plot));
28
$ab2plot = new AccBarPlot(array($b3plot,$b4plot));
29
 
30
// Create the grouped bar plot
31
$gbplot = new GroupBarPlot(array($ab1plot,$ab2plot));
32
 
33
// ...and add it to the graph
34
$graph->Add($gbplot);
35
 
36
$graph->title->Set("Grouped Accumulated bar plots");
37
$graph->xaxis->title->Set("X-title");
38
$graph->yaxis->title->Set("Y-title");
39
 
40
$graph->title->SetFont(FF_FONT1,FS_BOLD);
41
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
42
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
43
 
44
// Display the graph
45
$graph->Stroke();
46
?>