| 1 |
lars |
1 |
<?php
|
|
|
2 |
include_once ("../jpgraph.php");
|
|
|
3 |
include_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 |
$graph->yaxis->SetTitleMargin(30);
|
|
|
12 |
$graph->yaxis->scale->SetGrace(30);
|
|
|
13 |
$graph->SetShadow();
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
// Create a bar pot
|
|
|
17 |
$bplot = new BarPlot($datay);
|
|
|
18 |
|
|
|
19 |
// Create targets for the bars image maps. One for each column
|
|
|
20 |
$targ=array("bar_clsmex1.php#1","bar_clsmex1.php#2","bar_clsmex1.php#3","bar_clsmex1.php#4","bar_clsmex1.php#5","bar_clsmex1.php#6");
|
|
|
21 |
$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d");
|
|
|
22 |
$bplot->SetCSIMTargets($targ,$alts);
|
|
|
23 |
$bplot->SetFillColor("orange");
|
|
|
24 |
$bplot->SetLegend('Year 2001 %%','#kalle ','%s');
|
|
|
25 |
|
|
|
26 |
// Display the values on top of each bar
|
|
|
27 |
$bplot->SetShadow();
|
|
|
28 |
$bplot->value->SetFormat(" $ %2.1f",70);
|
|
|
29 |
$bplot->value->SetFont(FF_ARIAL,FS_NORMAL,9);
|
|
|
30 |
$bplot->value->SetColor("blue");
|
|
|
31 |
$bplot->value->Show();
|
|
|
32 |
|
|
|
33 |
$graph->Add($bplot);
|
|
|
34 |
|
|
|
35 |
// Create a big "button" that has an image map action
|
|
|
36 |
$txt1 = new Text("A simple text with\ntwo rows");
|
|
|
37 |
$txt1->SetFont(FF_ARIAL);
|
|
|
38 |
$txt1->SetBox('lightblue','black','white@1',5);
|
|
|
39 |
$txt1->SetParagraphAlign('center');
|
|
|
40 |
$txt1->SetPos(40,50);
|
|
|
41 |
$txt1->SetCSIMTarget('#88','Text element');
|
|
|
42 |
$graph->Add($txt1);
|
|
|
43 |
|
|
|
44 |
// Add image map to the graph title as well (you can do this to the
|
|
|
45 |
// sub- and subsub-title as well)
|
|
|
46 |
$graph->title->Set("Image maps barex1");
|
|
|
47 |
$graph->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
48 |
$graph->title->SetCSIMTarget('#45','Title for Bar');
|
|
|
49 |
$graph->xaxis->title->Set("X-title");
|
|
|
50 |
$graph->yaxis->title->Set("Y-title");
|
|
|
51 |
|
|
|
52 |
// Setup the axis title image map and font style
|
|
|
53 |
$graph->yaxis->title->SetFont(FF_FONT2,FS_BOLD);
|
|
|
54 |
$graph->yaxis->title->SetCSIMTarget('#55','Y-axis title');
|
|
|
55 |
$graph->xaxis->title->SetFont(FF_FONT2,FS_BOLD);
|
|
|
56 |
$graph->xaxis->title->SetCSIMTarget('#55','X-axis title');
|
|
|
57 |
|
|
|
58 |
// Send back the HTML page which will call this script again
|
|
|
59 |
// to retrieve the image.
|
|
|
60 |
$graph->StrokeCSIM('titlecsimex01.php');
|
|
|
61 |
|
|
|
62 |
?>
|