Blame view

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