Rev | Line | |
---|
[42] | 1 | <?php // content="text/plain; charset=utf-8" |
---|
| 2 | require_once ('jpgraph/jpgraph.php'); |
---|
| 3 | require_once ('jpgraph/jpgraph_bar.php'); |
---|
| 4 | |
---|
| 5 | $datay=array(10,29,3,6); |
---|
| 6 | |
---|
| 7 | // Create the graph. |
---|
| 8 | $graph = new Graph(200,200); |
---|
| 9 | $graph->SetScale('textlin'); |
---|
| 10 | $graph->SetMargin(25,10,20,25); |
---|
| 11 | $graph->SetBox(true); |
---|
| 12 | |
---|
| 13 | // Add 10% grace ("space") at top and botton of Y-scale. |
---|
| 14 | $graph->yscale->SetGrace(10); |
---|
| 15 | $graph->ygrid->Show(false); |
---|
| 16 | |
---|
| 17 | // Create a bar pot |
---|
| 18 | $bplot = new BarPlot($datay); |
---|
| 19 | $bplot->SetFillColor("lightblue"); |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | // .. and add the plot to the graph |
---|
| 23 | $graph->Add($bplot); |
---|
| 24 | |
---|
| 25 | // Add band |
---|
| 26 | $band = new PlotBand(HORIZONTAL,BAND_3DPLANE,15,35,'khaki4'); |
---|
| 27 | $band->SetDensity(80); |
---|
| 28 | $band->ShowFrame(true); |
---|
| 29 | $graph->AddBand($band); |
---|
| 30 | |
---|
| 31 | // Set title |
---|
| 32 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,10); |
---|
| 33 | $graph->title->SetColor('darkred'); |
---|
| 34 | $graph->title->Set('BAND_3DPLANE, Density=80'); |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | $graph->Stroke(); |
---|
| 38 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.