[42] | 1 | <?php // content="text/plain; charset=utf-8" |
---|
| 2 | require_once ('jpgraph/jpgraph.php'); |
---|
| 3 | require_once ('jpgraph/jpgraph_bar.php'); |
---|
| 4 | |
---|
| 5 | $datay1=array(13,8,19,7,17,6); |
---|
| 6 | $datay2=array(4,5,2,7,5,25); |
---|
| 7 | |
---|
| 8 | // Create the graph. |
---|
| 9 | $graph = new Graph(350,250); |
---|
| 10 | $graph->SetScale('textlin'); |
---|
| 11 | $graph->SetMarginColor('white'); |
---|
| 12 | |
---|
| 13 | // Setup title |
---|
| 14 | $graph->title->Set('Acc bar with gradient'); |
---|
| 15 | |
---|
| 16 | // Create the first bar |
---|
| 17 | $bplot = new BarPlot($datay1); |
---|
| 18 | $bplot->SetFillGradient('AntiqueWhite2','AntiqueWhite4:0.8',GRAD_VERT); |
---|
| 19 | $bplot->SetColor('darkred'); |
---|
| 20 | |
---|
| 21 | // Create the second bar |
---|
| 22 | $bplot2 = new BarPlot($datay2); |
---|
| 23 | $bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT); |
---|
| 24 | $bplot2->SetColor('darkgreen'); |
---|
| 25 | |
---|
| 26 | // And join them in an accumulated bar |
---|
| 27 | $accbplot = new AccBarPlot(array($bplot,$bplot2)); |
---|
| 28 | $accbplot->SetColor('red'); |
---|
| 29 | $accbplot->SetWeight(1); |
---|
| 30 | $graph->Add($accbplot); |
---|
| 31 | |
---|
| 32 | $graph->Stroke(); |
---|
| 33 | ?> |
---|