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 | $bplot->SetWeight(0); |
---|
21 | |
---|
22 | // Create the second bar |
---|
23 | $bplot2 = new BarPlot($datay2); |
---|
24 | $bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT); |
---|
25 | $bplot2->SetColor('darkgreen'); |
---|
26 | $bplot2->SetWeight(0); |
---|
27 | |
---|
28 | // And join them in an accumulated bar |
---|
29 | $accbplot = new AccBarPlot(array($bplot,$bplot2)); |
---|
30 | $accbplot->SetColor('darkgray'); |
---|
31 | $accbplot->SetWeight(1); |
---|
32 | $graph->Add($accbplot); |
---|
33 | |
---|
34 | $graph->Stroke(); |
---|
35 | ?> |
---|