Rev | Line | |
---|
[42] | 1 | <?php // content="text/plain; charset=utf-8" |
---|
| 2 | |
---|
| 3 | require_once ('jpgraph/jpgraph.php'); |
---|
| 4 | require_once ('jpgraph/jpgraph_bar.php'); |
---|
| 5 | |
---|
| 6 | // We need some data |
---|
| 7 | $datay=array(4,8,6); |
---|
| 8 | |
---|
| 9 | // Setup the graph. |
---|
| 10 | $graph = new Graph(200,150); |
---|
| 11 | $graph->SetScale("textlin"); |
---|
| 12 | $graph->img->SetMargin(25,15,25,25); |
---|
| 13 | |
---|
| 14 | $graph->title->Set('"GRAD_WIDE_MIDVER"'); |
---|
| 15 | $graph->title->SetColor('darkred'); |
---|
| 16 | |
---|
| 17 | // Setup font for axis |
---|
| 18 | $graph->xaxis->SetFont(FF_FONT1); |
---|
| 19 | $graph->yaxis->SetFont(FF_FONT1); |
---|
| 20 | |
---|
| 21 | // Create the bar pot |
---|
| 22 | $bplot = new BarPlot($datay); |
---|
| 23 | $bplot->SetWidth(0.6); |
---|
| 24 | |
---|
| 25 | // Setup color for gradient fill style |
---|
| 26 | $bplot->SetFillGradient("navy","lightsteelblue",GRAD_WIDE_MIDVER); |
---|
| 27 | |
---|
| 28 | // Set color for the frame of each bar |
---|
| 29 | $bplot->SetColor("navy"); |
---|
| 30 | $graph->Add($bplot); |
---|
| 31 | |
---|
| 32 | // Finally send the graph to the browser |
---|
| 33 | $graph->Stroke(); |
---|
| 34 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.