[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | // $Id: groupbarex1.php,v 1.2 2002/07/11 23:27:28 aditus Exp $
|
---|
| 3 | require_once ('jpgraph/jpgraph.php');
|
---|
| 4 | require_once ('jpgraph/jpgraph_bar.php');
|
---|
| 5 |
|
---|
| 6 | $datay1=array(35,160,0,0,0,0);
|
---|
| 7 | $datay2=array(35,190,190,190,190,190);
|
---|
| 8 | $datay3=array(20,70,70,140,230,260);
|
---|
| 9 |
|
---|
| 10 | $graph = new Graph(450,200,'auto');
|
---|
| 11 | $graph->SetScale("textlin");
|
---|
| 12 | $graph->SetShadow();
|
---|
| 13 | $graph->img->SetMargin(40,30,40,40);
|
---|
| 14 | $graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());
|
---|
| 15 |
|
---|
| 16 | $graph->xaxis->title->Set('Year 2002');
|
---|
| 17 | $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 18 |
|
---|
| 19 | $graph->title->Set('Group bar plot');
|
---|
| 20 | $graph->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 21 |
|
---|
| 22 | $bplot1 = new BarPlot($datay1);
|
---|
| 23 | $bplot2 = new BarPlot($datay2);
|
---|
| 24 | $bplot3 = new BarPlot($datay3);
|
---|
| 25 |
|
---|
| 26 | $bplot1->SetFillColor("orange");
|
---|
| 27 | $bplot2->SetFillColor("brown");
|
---|
| 28 | $bplot3->SetFillColor("darkgreen");
|
---|
| 29 |
|
---|
| 30 | $bplot1->SetShadow();
|
---|
| 31 | $bplot2->SetShadow();
|
---|
| 32 | $bplot3->SetShadow();
|
---|
| 33 |
|
---|
| 34 | $bplot1->SetShadow();
|
---|
| 35 | $bplot2->SetShadow();
|
---|
| 36 | $bplot3->SetShadow();
|
---|
| 37 |
|
---|
| 38 | $gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3));
|
---|
| 39 | $gbarplot->SetWidth(0.6);
|
---|
| 40 | $graph->Add($gbarplot);
|
---|
| 41 |
|
---|
| 42 | $graph->Stroke();
|
---|
| 43 | ?>
|
---|
| 44 |
|
---|