Blame view

site/graphe.php 1.36 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
  
ab15bd74   Guillaume   Test Graphe
6
7
8
9
  $history = getHistory('TempĂȘte', '', '', '2020-01-02 00:00:00', '2020-04-05 23:59:59', 4);
  $datay1 = makeArray($history, "value");
  
  //$datay1 = array(20,15,23,15);
a4e386fb   root   Ajout graphe V1
10
11
12
13
  $datay2 = array(12,9,42,8);
  $datay3 = array(5,17,32,24);
  
  // Setup the graph
360100a5   Guillaume   MAJ
14
  $graph = new Graph(800,400);
a4e386fb   root   Ajout graphe V1
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
50
51
52
53
54
55
56
57
58
59
60
  $graph->SetScale("textlin");
  
  $theme_class=new UniversalTheme;
  
  $graph->SetTheme($theme_class);
  $graph->img->SetAntiAliasing(false);
  $graph->title->Set('Filled Y-grid');
  $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");
  $graph->xaxis->SetTickLabels(array('A','B','C','D'));
  $graph->xgrid->SetColor('#E3E3E3');
  
  // Create the first line
  $p1 = new LinePlot($datay1);
  $graph->Add($p1);
  $p1->SetColor("#6495ED");
  $p1->SetLegend('Line 1');
  
  // Create the second line
  $p2 = new LinePlot($datay2);
  $graph->Add($p2);
  $p2->SetColor("#B22222");
  $p2->SetLegend('Line 2');
  
  // Create the third line
  $p3 = new LinePlot($datay3);
  $graph->Add($p3);
  $p3->SetColor("#FF1493");
  $p3->SetLegend('Line 3');
  
  $graph->legend->SetFrameWeight(1);
  
  // Output line
  $graph->Stroke();
  
  ?>