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']);
|
44a425e3
Guillaume
Test Graphe
|
7
8
|
$y = makeArray($history, "value");
$x = makeArray($history, "date");
|
44a425e3
Guillaume
Test Graphe
|
9
|
|
44eb6b3e
Guillaume
Test Graphe
|
10
11
|
$datay = array_reverse($y);
$datax = array_reverse($x);
|
a4e386fb
root
Ajout graphe V1
|
12
13
|
// Setup the graph
|
360100a5
Guillaume
MAJ
|
14
|
$graph = new Graph(800,400);
|
a4e386fb
root
Ajout graphe V1
|
15
16
17
18
19
20
|
$graph->SetScale("textlin");
$theme_class=new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
|
407dc302
root
Graphes ok
|
21
|
$graph->title->Set('Capteur '.$_REQUEST['nom']);
|
a4e386fb
root
Ajout graphe V1
|
22
23
|
$graph->SetBox(false);
|
407dc302
root
Graphes ok
|
24
|
$graph->SetMargin(40,30,40,50);
|
a4e386fb
root
Ajout graphe V1
|
25
26
27
28
29
30
31
32
33
|
$graph->img->SetAntiAliasing();
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
|
44a425e3
Guillaume
Test Graphe
|
34
|
$graph->xaxis->SetTickLabels($datax);
|
a4e386fb
root
Ajout graphe V1
|
35
36
|
$graph->xgrid->SetColor('#E3E3E3');
|
407dc302
root
Graphes ok
|
37
|
// Create the line
|
e7a12237
Guillaume
Test Graphe
|
38
39
40
|
$p = new LinePlot($datay);
$graph->Add($p);
$p->SetColor("#6495ED");
|
a4e386fb
root
Ajout graphe V1
|
41
|
|
407dc302
root
Graphes ok
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Afficher les valeurs pour chaque point
$p->value->Show();
// Valeurs: Apparence de la police
$p->value->SetFormat('%.1f');
$p->value->SetColor("red");
// Chaque point de la courbe ****
// Type de point
$p->mark->SetType(MARK_FILLEDCIRCLE);
// Couleur de remplissage
$p->mark->SetFillColor("green");
// Taille
$p->mark->SetWidth(5);
|
a4e386fb
root
Ajout graphe V1
|
57
58
59
60
61
|
// Output line
$graph->Stroke();
?>
|