1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_bar.php'); |
---|
4 | |
---|
5 | $datay=array(12,26,9,17,31); |
---|
6 | |
---|
7 | // Create the graph. |
---|
8 | // One minute timeout for the cached image |
---|
9 | // INLINE_NO means don't stream it back to the browser. |
---|
10 | $graph = new Graph(310,250,'auto'); |
---|
11 | $graph->SetScale("textlin"); |
---|
12 | $graph->img->SetMargin(60,30,20,40); |
---|
13 | $graph->yaxis->SetTitleMargin(45); |
---|
14 | $graph->yaxis->scale->SetGrace(30); |
---|
15 | $graph->SetShadow(); |
---|
16 | |
---|
17 | // Turn the tickmarks |
---|
18 | $graph->xaxis->SetTickSide(SIDE_DOWN); |
---|
19 | $graph->yaxis->SetTickSide(SIDE_LEFT); |
---|
20 | |
---|
21 | // Create a bar pot |
---|
22 | $bplot = new BarPlot($datay); |
---|
23 | |
---|
24 | // Create targets for the image maps. One for each column |
---|
25 | $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"); |
---|
26 | $alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d"); |
---|
27 | $bplot->SetCSIMTargets($targ,$alts); |
---|
28 | $bplot->SetFillColor("orange"); |
---|
29 | |
---|
30 | // Use a shadow on the bar graphs (just use the default settings) |
---|
31 | $bplot->SetShadow(); |
---|
32 | $bplot->value->SetFormat(" $ %2.1f",70); |
---|
33 | $bplot->value->SetFont(FF_ARIAL,FS_NORMAL,9); |
---|
34 | $bplot->value->SetColor("blue"); |
---|
35 | $bplot->value->Show(); |
---|
36 | |
---|
37 | $graph->Add($bplot); |
---|
38 | |
---|
39 | $graph->title->Set("Image maps barex1"); |
---|
40 | $graph->xaxis->title->Set("X-title"); |
---|
41 | $graph->yaxis->title->Set("Y-title"); |
---|
42 | |
---|
43 | $graph->title->SetFont(FF_FONT1,FS_BOLD); |
---|
44 | $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); |
---|
45 | $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); |
---|
46 | |
---|
47 | // Send back the HTML page which will call this script again |
---|
48 | // to retrieve the image. |
---|
49 | $graph->StrokeCSIM(); |
---|
50 | |
---|
51 | |
---|
52 | ?> |
---|