Blame view

site/graphe.php 1.44 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
7
  $history = getHistory($_REQUEST['nom'], '', '', $_REQUEST['start'], $_REQUEST['end'], $_REQUEST['nombre']);
  $datay1 = makeArray($history, "value");
8906dd89   Guillaume   Test Graphe
8
  $absc = makeArray($history, "value");
399273b9   Guillaume   Test Graphe
9
  
594ae01e   Guillaume   Test Graphe
10
11
  //$history2 = getHistory('Atmos', '', '', '2020-01-02 00:00:00', '2020-04-05 23:59:59', 4);
  //$datay2 = makeArray($history2, "value");
399273b9   Guillaume   Test Graphe
12
  
594ae01e   Guillaume   Test Graphe
13
14
  //$history3 = getHistory('Fusion', '', '', '2020-01-02 00:00:00', '2020-04-05 23:59:59', 4);
  //$datay3 = makeArray($history3, "value");
ab15bd74   Guillaume   Test Graphe
15
16
  
  //$datay1 = array(20,15,23,15);
399273b9   Guillaume   Test Graphe
17
18
  //$datay2 = array(12,9,42,8);
  //$datay3 = array(5,17,32,24);
a4e386fb   root   Ajout graphe V1
19
20
  
  // Setup the graph
360100a5   Guillaume   MAJ
21
  $graph = new Graph(800,400);
a4e386fb   root   Ajout graphe V1
22
23
24
25
26
27
  $graph->SetScale("textlin");
  
  $theme_class=new UniversalTheme;
  
  $graph->SetTheme($theme_class);
  $graph->img->SetAntiAliasing(false);
594ae01e   Guillaume   Test Graphe
28
  $graph->title->Set('Graphique');
a4e386fb   root   Ajout graphe V1
29
30
31
32
33
34
35
36
37
38
39
40
  $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");
b7ad4458   Guillaume   Test Graphe
41
  $graph->xaxis->SetTickLabels(Array('A', 'B', 'C', 'D'));
a4e386fb   root   Ajout graphe V1
42
43
44
  $graph->xgrid->SetColor('#E3E3E3');
  
  // Create the first line
e7a12237   Guillaume   Test Graphe
45
46
47
48
  $p = new LinePlot($datay);
  $graph->Add($p);
  $p->SetColor("#6495ED");
  $p->SetLegend('Line 1');
a4e386fb   root   Ajout graphe V1
49
50
51
52
53
54
55
  
  $graph->legend->SetFrameWeight(1);
  
  // Output line
  $graph->Stroke();
  
  ?>