25 |
require_once(DOL_DOCUMENT_ROOT."/energie/EnergieCompteur.class.php"); |
require_once(DOL_DOCUMENT_ROOT."/energie/EnergieCompteur.class.php"); |
26 |
require_once(DOL_DOCUMENT_ROOT."/energie/EnergieGroupe.class.php"); |
require_once(DOL_DOCUMENT_ROOT."/energie/EnergieGroupe.class.php"); |
27 |
|
|
28 |
include_once ("/usr/share/jpgraph/jpgraph.php"); |
include_once (JPGRAPH_DIR."jpgraph.php"); |
29 |
include_once ("/usr/share/jpgraph/jpgraph_line.php"); |
include_once (JPGRAPH_DIR."jpgraph_line.php"); |
30 |
include_once ("/usr/share/jpgraph/jpgraph_bar.php"); |
include_once (JPGRAPH_DIR."jpgraph_bar.php"); |
31 |
include_once ("/usr/share/jpgraph/jpgraph_pie.php"); |
include_once (JPGRAPH_DIR."jpgraph_pie.php"); |
32 |
include_once ("/usr/share/jpgraph/jpgraph_error.php"); |
include_once (JPGRAPH_DIR."jpgraph_error.php"); |
33 |
include_once ("/usr/share/jpgraph/jpgraph_canvas.php"); |
include_once (JPGRAPH_DIR."jpgraph_canvas.php"); |
34 |
|
|
35 |
$error = 0; |
$error = 0; |
36 |
|
|
128 |
$maxa = max($maxa, $xa); |
$maxa = max($maxa, $xa); |
129 |
|
|
130 |
$gdatas[$i-1] = $xa; |
$gdatas[$i-1] = $xa; |
131 |
$glabels[$i-1] = strftime("%d%m",$datas[$i][1]); |
$glabels[$i-1] = '';//strftime("%d%m",$datas[$i][1]); |
132 |
|
|
133 |
$month = strftime("%m%y",$datas[$i][1]); |
$month = strftime("%m%y",$datas[$i][1]); |
134 |
|
|
143 |
$ydatas[$compteur_id][$year] = $ydatas[$compteur_id][$year] + $xa; |
$ydatas[$compteur_id][$year] = $ydatas[$compteur_id][$year] + $xa; |
144 |
} |
} |
145 |
|
|
146 |
$width = 450; |
$width = 750; |
147 |
$height = 300; |
$height = 300; |
148 |
|
|
149 |
$graph = new Graph($width, $height,"auto"); |
$graph = new Graph($width, $height,"auto"); |
160 |
|
|
161 |
$graph->title->Set("Consommation par jour"); |
$graph->title->Set("Consommation par jour"); |
162 |
|
|
|
//$graph->title->SetFont(FF_VERDANA,FS_NORMAL); |
|
|
|
|
163 |
$graph->xaxis->SetTickLabels($glabels); |
$graph->xaxis->SetTickLabels($glabels); |
164 |
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); |
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); |
165 |
|
|
166 |
$graph->Add($b2plot); |
$graph->Add($b2plot); |
|
|
|
|
// Display the graph |
|
|
|
|
167 |
$graph->img->SetImgFormat("png"); |
$graph->img->SetImgFormat("png"); |
168 |
|
|
169 |
$file= DOL_DATA_ROOT."/energie/graph/day.".$obj_c->rowid.".png"; |
$file= DOL_DATA_ROOT."/energie/graph/day.".$obj_c->rowid.".png"; |
170 |
|
|
171 |
$graph->Stroke($file); |
$graph->Stroke($file); |
172 |
|
|
173 |
|
$width = 450; |
174 |
|
$height = 300; |
175 |
|
|
176 |
// Mensuel |
// Mensuel |
177 |
$i=0; |
$i=0; |
207 |
$graph->Stroke($file); |
$graph->Stroke($file); |
208 |
|
|
209 |
// Hebdomadaire |
// Hebdomadaire |
210 |
|
$width = 750; |
211 |
|
$height = 300; |
212 |
$i=0; |
$i=0; |
213 |
foreach ($wdatas[$compteur_id] as $key => $value) |
foreach ($wdatas[$compteur_id] as $key => $value) |
214 |
{ |
{ |
215 |
$gwdatas[$i] = $value; |
$gwdatas[$i] = $value; |
216 |
$gwlabels[$i] = $key; |
$gwlabels[$i] = substr($key,0,2); |
217 |
$i++; |
$i++; |
218 |
} |
} |
219 |
|
|
241 |
$graph->Stroke($file); |
$graph->Stroke($file); |
242 |
|
|
243 |
// Annuel |
// Annuel |
244 |
|
$width = 450; |
245 |
|
$height = 300; |
246 |
$i=0; |
$i=0; |
247 |
foreach ($ydatas[$compteur_id] as $key => $value) |
foreach ($ydatas[$compteur_id] as $key => $value) |
248 |
{ |
{ |