Blame view

site/jpgraph/Examples/centerlinebarex1.php 682 Bytes
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
  <?php // content="text/plain; charset=utf-8"
  
  require_once ('jpgraph/jpgraph.php');
  require_once ('jpgraph/jpgraph_bar.php');
  require_once ('jpgraph/jpgraph_line.php');
  
  
  $ydata = array(12,15,22,19,5);
  
  $graph = new Graph(400,200);
  $graph->clearTheme();
  $graph->img->SetMargin(40,80,40,40);
  $graph->SetScale("textlin");
  $graph->SetShadow();
  
  $graph->title->Set('Center the line points in bars');
  
  $line = new LinePlot($ydata);
  $line->SetBarCenter();
  $line->SetWeight(2);
  
  $bar = new BarPlot($ydata);
  $bar2 = new BarPlot($ydata);
  $bar2->SetFillColor("red");
  
  $gbar = new GroupbarPlot(array($bar,$bar2));
  
  $graph->Add($gbar);
  $graph->Add($line);
  
  // Output line
  $graph->Stroke();
  
  ?>