Blame view

site/jpgraph/src/Examples/boxstockex1.php 818 Bytes
d72ac078   Guillaume   Ajout graphe V1.1
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"
  // Example of a stock chart
  require_once ('jpgraph/jpgraph.php');
  require_once ('jpgraph/jpgraph_stock.php');
  
  // Data must be in the format : open,close,min,max,median
  $datay = array(
      34,42,27,45,36,
      55,25,14,59,40,
      15,40,12,47,23,
      62,38,25,65,57,
      38,49,32,64,45);
  
  // Setup a simple graph
  $graph = new Graph(300,200);
  $graph->clearTheme();
  $graph->SetScale('textlin');
  $graph->SetMarginColor('lightblue');
  $graph->title->Set('Box Stock chart example');
  
  // Create a new stock plot
  $p1 = new BoxPlot($datay);
  
  // Width of the bars (in pixels)
  $p1->SetWidth(9);
  
  // Uncomment the following line to hide the horizontal end lines
  //$p1->HideEndLines();
  
  // Add the plot to the graph and send it back to the browser
  $graph->Add($p1);
  $graph->Stroke();
  
  ?>