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