Blame view

site/graphe.php 1.06 KB
a4e386fb   root   Ajout graphe V1
1
  <?php // content="text/plain; charset=utf-8"
e65076e1   root   MAJ
2
3
  require_once ('jpgraph/jpgraph.php');
  require_once ('jpgraph/jpgraph_line.php');
ab15bd74   Guillaume   Test Graphe
4
  require_once('accesBase.php');
a4e386fb   root   Ajout graphe V1
5
  
e7a12237   Guillaume   Test Graphe
6
  $history = getHistory($_REQUEST['nom'], '', '', $_REQUEST['start'], $_REQUEST['end'], $_REQUEST['nombre']);
8445b765   Guillaume   Test Graphe
7
  $datay = makeArray($history, "value");
7d660701   Guillaume   Test Graphe
8
  $dates = makeArray($history, "date");
a4e386fb   root   Ajout graphe V1
9
10
  
  // Setup the graph
360100a5   Guillaume   MAJ
11
  $graph = new Graph(800,400);
a4e386fb   root   Ajout graphe V1
12
13
14
15
16
17
  $graph->SetScale("textlin");
  
  $theme_class=new UniversalTheme;
  
  $graph->SetTheme($theme_class);
  $graph->img->SetAntiAliasing(false);
8445b765   Guillaume   Test Graphe
18
  $graph->title->Set('Filled Y-grid');
a4e386fb   root   Ajout graphe V1
19
20
21
22
23
24
25
26
27
28
29
30
  $graph->SetBox(false);
  
  $graph->SetMargin(40,20,36,63);
  
  $graph->img->SetAntiAliasing();
  
  $graph->yaxis->HideZeroLabel();
  $graph->yaxis->HideLine(false);
  $graph->yaxis->HideTicks(false,false);
  
  $graph->xgrid->Show();
  $graph->xgrid->SetLineStyle("solid");
7d660701   Guillaume   Test Graphe
31
  $graph->xaxis->SetTickLabels($dates);
a4e386fb   root   Ajout graphe V1
32
33
34
  $graph->xgrid->SetColor('#E3E3E3');
  
  // Create the first line
e7a12237   Guillaume   Test Graphe
35
36
37
  $p = new LinePlot($datay);
  $graph->Add($p);
  $p->SetColor("#6495ED");
8445b765   Guillaume   Test Graphe
38
  $p->SetLegend('Capteur');
a4e386fb   root   Ajout graphe V1
39
40
41
42
43
44
45
  
  $graph->legend->SetFrameWeight(1);
  
  // Output line
  $graph->Stroke();
  
  ?>