Commit e7a12237a4889b75e3480d55cc2609e924e13988
1 parent
594ae01e
Test Graphe
Showing
1 changed file
with
8 additions
and
19 deletions
Show diff stats
site/graphe.php
@@ -3,8 +3,9 @@ require_once ('jpgraph/jpgraph.php'); | @@ -3,8 +3,9 @@ require_once ('jpgraph/jpgraph.php'); | ||
3 | require_once ('jpgraph/jpgraph_line.php'); | 3 | require_once ('jpgraph/jpgraph_line.php'); |
4 | require_once('accesBase.php'); | 4 | require_once('accesBase.php'); |
5 | 5 | ||
6 | -$history1 = getHistory($_REQUEST['nom'], '', '', $_REQUEST['start'], $_REQUEST['end'], $_REQUEST['nombre']); | ||
7 | -$datay1 = makeArray($history1, "value"); | 6 | +$history = getHistory($_REQUEST['nom'], '', '', $_REQUEST['start'], $_REQUEST['end'], $_REQUEST['nombre']); |
7 | +$datay1 = makeArray($history, "value"); | ||
8 | +$absc = makeArray($history, "date"); | ||
8 | 9 | ||
9 | //$history2 = getHistory('Atmos', '', '', '2020-01-02 00:00:00', '2020-04-05 23:59:59', 4); | 10 | //$history2 = getHistory('Atmos', '', '', '2020-01-02 00:00:00', '2020-04-05 23:59:59', 4); |
10 | //$datay2 = makeArray($history2, "value"); | 11 | //$datay2 = makeArray($history2, "value"); |
@@ -37,26 +38,14 @@ $graph->yaxis->HideTicks(false,false); | @@ -37,26 +38,14 @@ $graph->yaxis->HideTicks(false,false); | ||
37 | 38 | ||
38 | $graph->xgrid->Show(); | 39 | $graph->xgrid->Show(); |
39 | $graph->xgrid->SetLineStyle("solid"); | 40 | $graph->xgrid->SetLineStyle("solid"); |
40 | -$graph->xaxis->SetTickLabels(array('A','B','C','D')); | 41 | +$graph->xaxis->SetTickLabels($absc); |
41 | $graph->xgrid->SetColor('#E3E3E3'); | 42 | $graph->xgrid->SetColor('#E3E3E3'); |
42 | 43 | ||
43 | // Create the first line | 44 | // Create the first line |
44 | -$p1 = new LinePlot($datay1); | ||
45 | -$graph->Add($p1); | ||
46 | -$p1->SetColor("#6495ED"); | ||
47 | -$p1->SetLegend('Line 1'); | ||
48 | - | ||
49 | -// Create the second line | ||
50 | -//$p2 = new LinePlot($datay2); | ||
51 | -//$graph->Add($p2); | ||
52 | -//$p2->SetColor("#B22222"); | ||
53 | -//$p2->SetLegend('Line 2'); | ||
54 | - | ||
55 | -// Create the third line | ||
56 | -//$p3 = new LinePlot($datay3); | ||
57 | -//$graph->Add($p3); | ||
58 | -//$p3->SetColor("#FF1493"); | ||
59 | -//$p3->SetLegend('Line 3'); | 45 | +$p = new LinePlot($datay); |
46 | +$graph->Add($p); | ||
47 | +$p->SetColor("#6495ED"); | ||
48 | +$p->SetLegend('Line 1'); | ||
60 | 49 | ||
61 | $graph->legend->SetFrameWeight(1); | 50 | $graph->legend->SetFrameWeight(1); |
62 | 51 |