| 1 |
lars |
1 |
<?php
|
|
|
2 |
// Illustration of the different patterns for bands
|
|
|
3 |
// $Id: smallstaticbandsex3.php,v 1.1 2002/09/01 21:51:08 aditus Exp $
|
|
|
4 |
include ("../jpgraph.php");
|
|
|
5 |
include ("../jpgraph_bar.php");
|
|
|
6 |
|
|
|
7 |
$datay=array(10,29,3,6);
|
|
|
8 |
|
|
|
9 |
// Create the graph.
|
|
|
10 |
$graph = new Graph(200,150,"auto");
|
|
|
11 |
$graph->SetScale("textlin");
|
|
|
12 |
$graph->SetMargin(25,10,20,20);
|
|
|
13 |
|
|
|
14 |
// Add 10% grace ("space") at top and botton of Y-scale.
|
|
|
15 |
$graph->yscale->SetGrace(10);
|
|
|
16 |
|
|
|
17 |
// Create a bar pot
|
|
|
18 |
$bplot = new BarPlot($datay);
|
|
|
19 |
$bplot->SetFillColor("lightblue");
|
|
|
20 |
|
|
|
21 |
// Position the X-axis at the bottom of the plotare
|
|
|
22 |
$graph->xaxis->SetPos("min");
|
|
|
23 |
|
|
|
24 |
$graph->ygrid->Show(false);
|
|
|
25 |
|
|
|
26 |
// .. and add the plot to the graph
|
|
|
27 |
$graph->Add($bplot);
|
|
|
28 |
|
|
|
29 |
// Add band
|
|
|
30 |
$band = new PlotBand(HORIZONTAL,BAND_SOLID,15,35,'khaki4');
|
|
|
31 |
$band->ShowFrame(false);
|
|
|
32 |
$graph->AddBand($band);
|
|
|
33 |
|
|
|
34 |
// Set title
|
|
|
35 |
$graph->title->SetFont(FF_ARIAL,FS_BOLD,10);
|
|
|
36 |
$graph->title->SetColor('darkred');
|
|
|
37 |
$graph->title->Set('BAND_SOLID');
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
$graph->Stroke();
|
|
|
41 |
?>
|