1 | <?php // content="text/plain; charset=utf-8"
|
---|
2 |
|
---|
3 | require_once ('jpgraph/jpgraph.php');
|
---|
4 | require_once ('jpgraph/jpgraph_bar.php');
|
---|
5 |
|
---|
6 | $data1y=array(-8,8,9,3,5,6);
|
---|
7 | $data2y=array(18,2,1,7,5,4);
|
---|
8 |
|
---|
9 | // Create the graph. These two calls are always required
|
---|
10 | $graph = new Graph(500,400);
|
---|
11 | $graph->SetScale("textlin");
|
---|
12 |
|
---|
13 | $graph->SetShadow();
|
---|
14 | $graph->img->SetMargin(40,30,20,40);
|
---|
15 |
|
---|
16 | // Create the bar plots
|
---|
17 | $b1plot = new BarPlot($data1y);
|
---|
18 | $b1plot->SetFillColor("orange");
|
---|
19 | $b1plot->value->Show();
|
---|
20 | $b2plot = new BarPlot($data2y);
|
---|
21 | $b2plot->SetFillColor("blue");
|
---|
22 | $b2plot->value->Show();
|
---|
23 |
|
---|
24 | // Create the grouped bar plot
|
---|
25 | $gbplot = new AccBarPlot(array($b1plot,$b2plot));
|
---|
26 |
|
---|
27 | // ...and add it to the graPH
|
---|
28 | $graph->Add($gbplot);
|
---|
29 |
|
---|
30 | $graph->title->Set("Accumulated bar plots");
|
---|
31 | $graph->xaxis->title->Set("X-title");
|
---|
32 | $graph->yaxis->title->Set("Y-title");
|
---|
33 |
|
---|
34 | $graph->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
35 | $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
36 | $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
37 |
|
---|
38 | // Display the graph
|
---|
39 | $graph->Stroke();
|
---|
40 | ?>
|
---|