| 1 |
lars |
1 |
<?php
|
|
|
2 |
// $Id: logbarex1.php,v 1.4 2003/05/30 20:12:43 aditus Exp $
|
|
|
3 |
include ("../jpgraph.php");
|
|
|
4 |
include ("../jpgraph_log.php");
|
|
|
5 |
include ("../jpgraph_bar.php");
|
|
|
6 |
|
|
|
7 |
$datay=array(4,13,30,28,12,45,30,12,55,3,0.5);
|
|
|
8 |
$datax=array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov");
|
|
|
9 |
|
|
|
10 |
// Create the graph.
|
|
|
11 |
$graph = new Graph(400,220,'auto');
|
|
|
12 |
//$graph->img->SetMargin(50,30,50,50);
|
|
|
13 |
$graph->SetScale("textlog");
|
|
|
14 |
//$graph->SetShadow();
|
|
|
15 |
|
|
|
16 |
// Setup titles for graph and axis
|
|
|
17 |
$graph->title->Set("Bar with logarithmic Y-scale");
|
|
|
18 |
$graph->title->SetFont(FF_VERDANA,FS_NORMAL,18);
|
|
|
19 |
|
|
|
20 |
$graph->xaxis->SetTitle("2002");
|
|
|
21 |
$graph->xaxis->title->SetFont(FF_ARIAL,FS_NORMAL,16);
|
|
|
22 |
|
|
|
23 |
$graph->yaxis->title->SetFont(FF_ARIAL,FS_NORMAL,16);
|
|
|
24 |
$graph->yaxis->SetTitle("Y-title",'center');
|
|
|
25 |
$graph->yaxis->SetTitleMargin(30);
|
|
|
26 |
|
|
|
27 |
// Setup month on X-scale
|
|
|
28 |
//$graph->xaxis->SetTickLabels($datax);
|
|
|
29 |
|
|
|
30 |
// Create a bar pot
|
|
|
31 |
$bplot = new BarPlot($datay);
|
|
|
32 |
$bplot->SetFillColor("orange");
|
|
|
33 |
|
|
|
34 |
//You can also set a manual base of the bars
|
|
|
35 |
//$bplot->SetYBase(0.001);
|
|
|
36 |
|
|
|
37 |
/*
|
|
|
38 |
$bplot->SetShadow();
|
|
|
39 |
$bplot->value->Show();
|
|
|
40 |
$bplot->value->SetFont(FF_ARIAL,FS_BOLD);
|
|
|
41 |
$bplot->value->SetAngle(45);
|
|
|
42 |
$bplot->value->SetColor("black","darkred");
|
|
|
43 |
*/
|
|
|
44 |
|
|
|
45 |
$graph->Add($bplot);
|
|
|
46 |
|
|
|
47 |
$graph->Stroke();
|
|
|
48 |
?>
|