[42] | 1 | <?php // content="text/plain; charset=utf-8" |
---|
| 2 | // Illustration of the different patterns for bands |
---|
| 3 | // $Id: smallstaticbandsex4.php,v 1.1 2002/09/01 21:51:08 aditus Exp $ |
---|
| 4 | require_once ('jpgraph/jpgraph.php'); |
---|
| 5 | require_once ('jpgraph/jpgraph_bar.php'); |
---|
| 6 | |
---|
| 7 | $datay=array(10,29,3,6); |
---|
| 8 | |
---|
| 9 | // Create the graph. |
---|
| 10 | $graph = new Graph(200,150); |
---|
| 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_3DPLANE,15,35,'khaki4'); |
---|
| 31 | $band->SetDensity(80); |
---|
| 32 | $band->ShowFrame(true); |
---|
| 33 | $graph->Add($band); |
---|
| 34 | |
---|
| 35 | // Set title |
---|
| 36 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,10); |
---|
| 37 | $graph->title->SetColor('darkred'); |
---|
| 38 | $graph->title->Set('BAND_3DPLANE, Density=60'); |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | $graph->Stroke(); |
---|
| 42 | ?> |
---|