[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | require_once ('../jpgraph.php');
|
---|
| 3 | require_once ('../jpgraph_bar.php');
|
---|
| 4 |
|
---|
| 5 | $datay=array(12,26,9,17,31);
|
---|
| 6 |
|
---|
| 7 | // Create the graph.
|
---|
| 8 | $graph = new Graph(400,250);
|
---|
| 9 | $graph->SetScale('textlin');
|
---|
| 10 | $graph->SetMargin(50,80,20,40);
|
---|
| 11 |
|
---|
| 12 | // Create a bar pot
|
---|
| 13 | $bplot = new BarPlot($datay);
|
---|
| 14 |
|
---|
| 15 | $n = count($datay) ; // Number of bars
|
---|
| 16 |
|
---|
| 17 | global $_wrapperfilename;
|
---|
| 18 |
|
---|
| 19 | // Create targets for the image maps. One for each column
|
---|
| 20 | $targ = array(); $alt = array(); $wtarg = array();
|
---|
| 21 | for( $i=0; $i < $n; ++$i ) {
|
---|
| 22 | $urlarg = 'clickedon='.($i+1);
|
---|
| 23 | $targ[] = $_wrapperfilename.'?'.$urlarg;
|
---|
| 24 | $alt[] = 'val=%d';
|
---|
| 25 | $wtarg[] = '';
|
---|
| 26 | }
|
---|
| 27 | $bplot->SetCSIMTargets($targ,$alt,$wtarg);
|
---|
| 28 |
|
---|
| 29 | $graph->Add($bplot);
|
---|
| 30 |
|
---|
| 31 | $graph->title->Set('Multiple Image maps');
|
---|
| 32 | $graph->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 33 | $graph->title->SetCSIMTarget('#45','Title for Bar','_blank');
|
---|
| 34 |
|
---|
| 35 | $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 36 | $graph->yaxis->title->SetCSIMTarget('#55','Y-axis title');
|
---|
| 37 | $graph->yaxis->title->Set("Y-title");
|
---|
| 38 |
|
---|
| 39 | $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 40 | $graph->xaxis->title->SetCSIMTarget('#55','X-axis title');
|
---|
| 41 | $graph->xaxis->title->Set("X-title");
|
---|
| 42 |
|
---|
| 43 | // Send back the image when we are called from within the <img> tag
|
---|
| 44 | $graph->StrokeCSIMImage();
|
---|
| 45 |
|
---|
| 46 | ?>
|
---|