[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_bar.php');
|
---|
| 4 |
|
---|
| 5 | $data1y=array(12,8,19,3,10,5);
|
---|
| 6 | $data2y=array(8,2,12,7,14,4);
|
---|
| 7 |
|
---|
| 8 | // Create the graph. These two calls are always required
|
---|
| 9 | $graph = new Graph(310,200,'auto');
|
---|
| 10 | $graph->SetScale("textlin");
|
---|
| 11 | $graph->img->SetMargin(40,30,20,40);
|
---|
| 12 | $graph->SetShadow();
|
---|
| 13 |
|
---|
| 14 | // Create the bar plots
|
---|
| 15 | $b1plot = new BarPlot($data1y);
|
---|
| 16 | $b1plot->SetFillColor("orange");
|
---|
| 17 | $targ=array("bar_clsmex2.php#1","bar_clsmex2.php#2","bar_clsmex2.php#3",
|
---|
| 18 | "bar_clsmex2.php#4","bar_clsmex2.php#5","bar_clsmex2.php#6");
|
---|
| 19 | $alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d");
|
---|
| 20 | $b1plot->SetCSIMTargets($targ,$alts);
|
---|
| 21 |
|
---|
| 22 | $b2plot = new BarPlot($data2y);
|
---|
| 23 | $b2plot->SetFillColor("blue");
|
---|
| 24 | $targ=array("bar_clsmex2.php#7","bar_clsmex2.php#8","bar_clsmex2.php#9",
|
---|
| 25 | "bar_clsmex2.php#10","bar_clsmex2.php#11","bar_clsmex2.php#12");
|
---|
| 26 | $alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d");
|
---|
| 27 | $b2plot->SetCSIMTargets($targ,$alts);
|
---|
| 28 |
|
---|
| 29 | // Create the grouped bar plot
|
---|
| 30 | $abplot = new AccBarPlot(array($b1plot,$b2plot));
|
---|
| 31 |
|
---|
| 32 | $abplot->SetShadow();
|
---|
| 33 | $abplot->value->Show();
|
---|
| 34 |
|
---|
| 35 | // ...and add it to the graPH
|
---|
| 36 | $graph->Add($abplot);
|
---|
| 37 |
|
---|
| 38 | $graph->title->Set("Image map barex2");
|
---|
| 39 | $graph->xaxis->title->Set("X-title");
|
---|
| 40 | $graph->yaxis->title->Set("Y-title");
|
---|
| 41 |
|
---|
| 42 | $graph->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 43 | $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 44 | $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 | // Send back the HTML page which will call this script again
|
---|
| 48 | // to retrieve the image.
|
---|
| 49 | $graph->StrokeCSIM();
|
---|
| 50 |
|
---|
| 51 | ?>
|
---|