Commit 44a425e38a4424f9e08b7b8b790b34b73fdeec0a
1 parent
7d660701
Test Graphe
Showing
1 changed file
with
10 additions
and
3 deletions
Show diff stats
site/graphe.php
@@ -4,8 +4,15 @@ require_once ('jpgraph/jpgraph_line.php'); | @@ -4,8 +4,15 @@ require_once ('jpgraph/jpgraph_line.php'); | ||
4 | require_once('accesBase.php'); | 4 | require_once('accesBase.php'); |
5 | 5 | ||
6 | $history = getHistory($_REQUEST['nom'], '', '', $_REQUEST['start'], $_REQUEST['end'], $_REQUEST['nombre']); | 6 | $history = getHistory($_REQUEST['nom'], '', '', $_REQUEST['start'], $_REQUEST['end'], $_REQUEST['nombre']); |
7 | -$datay = makeArray($history, "value"); | ||
8 | -$dates = makeArray($history, "date"); | 7 | +$y = makeArray($history, "value"); |
8 | +$x = makeArray($history, "date"); | ||
9 | +str_replace(" ", "\n", $datax); | ||
10 | + | ||
11 | +for(int i=0; i<count($y); i++) | ||
12 | +{ | ||
13 | + $datay[] = $y[count($y)-i-1]; | ||
14 | + $datax[] = $x[count($y)-i-1]; | ||
15 | +} | ||
9 | 16 | ||
10 | // Setup the graph | 17 | // Setup the graph |
11 | $graph = new Graph(800,400); | 18 | $graph = new Graph(800,400); |
@@ -28,7 +35,7 @@ $graph->yaxis->HideTicks(false,false); | @@ -28,7 +35,7 @@ $graph->yaxis->HideTicks(false,false); | ||
28 | 35 | ||
29 | $graph->xgrid->Show(); | 36 | $graph->xgrid->Show(); |
30 | $graph->xgrid->SetLineStyle("solid"); | 37 | $graph->xgrid->SetLineStyle("solid"); |
31 | -$graph->xaxis->SetTickLabels($dates); | 38 | +$graph->xaxis->SetTickLabels($datax); |
32 | $graph->xgrid->SetColor('#E3E3E3'); | 39 | $graph->xgrid->SetColor('#E3E3E3'); |
33 | 40 | ||
34 | // Create the first line | 41 | // Create the first line |