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