145 |
|
|
146 |
$width = 750; |
$width = 750; |
147 |
$height = 300; |
$height = 300; |
148 |
|
if (sizeof($gdatas) > 2) |
149 |
|
{ |
150 |
|
$graph = new Graph($width, $height,"auto"); |
151 |
|
$graph->SetScale("textlin",0,$maxa); |
152 |
|
|
153 |
$graph = new Graph($width, $height,"auto"); |
$graph->yaxis->scale->SetGrace(2); |
154 |
$graph->SetScale("textlin",0,$maxa); |
$graph->SetFrame(1); |
155 |
|
$graph->img->SetMargin(40,20,20,35); |
|
$graph->yaxis->scale->SetGrace(2); |
|
|
$graph->SetFrame(1); |
|
|
$graph->img->SetMargin(40,20,20,35); |
|
156 |
|
|
157 |
$b2plot = new LinePlot($gdatas); |
$b2plot = new LinePlot($gdatas); |
158 |
|
|
159 |
$b2plot->SetColor("blue"); |
$b2plot->SetColor("blue"); |
160 |
$b2plot->SetWeight(2); |
$b2plot->SetWeight(2); |
161 |
|
|
162 |
$graph->title->Set("Consommation par jour"); |
$graph->title->Set("Consommation par jour"); |
163 |
|
|
164 |
$graph->xaxis->SetTickLabels($glabels); |
$graph->xaxis->SetTickLabels($glabels); |
165 |
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); |
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); |
166 |
|
|
167 |
$graph->Add($b2plot); |
$graph->Add($b2plot); |
168 |
$graph->img->SetImgFormat("png"); |
$graph->img->SetImgFormat("png"); |
|
|
|
|
$file= DOL_DATA_ROOT."/energie/graph/day.".$obj_c->rowid.".png"; |
|
|
|
|
|
if (sizeof($gdatas) > 2) |
|
|
$graph->Stroke($file); |
|
169 |
|
|
170 |
|
$file= DOL_DATA_ROOT."/energie/graph/day.".$obj_c->rowid.".png"; |
171 |
|
|
172 |
|
$graph->Stroke($file); |
173 |
|
} |
174 |
$width = 450; |
$width = 450; |
175 |
$height = 300; |
$height = 300; |
176 |
|
|
182 |
$gmlabels[$i] = $key; |
$gmlabels[$i] = $key; |
183 |
$i++; |
$i++; |
184 |
} |
} |
|
|
|
|
$graph = new Graph($width, $height,"auto"); |
|
|
$graph->SetScale("textlin"); |
|
|
|
|
|
$graph->yaxis->scale->SetGrace(2); |
|
|
$graph->SetFrame(1); |
|
|
$graph->img->SetMargin(40,20,20,35); |
|
|
|
|
|
$b2plot = new BarPlot($gmdatas); |
|
|
|
|
|
$b2plot->SetFillColor("blue"); |
|
|
|
|
|
$graph->title->Set("Consommation par mois"); |
|
|
|
|
|
$graph->xaxis->SetTickLabels($gmlabels); |
|
|
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); |
|
|
|
|
|
$graph->Add($b2plot); |
|
|
|
|
|
$graph->img->SetImgFormat("png"); |
|
|
|
|
|
$file= DOL_DATA_ROOT."/energie/graph/month.".$obj_c->rowid.".png"; |
|
|
|
|
185 |
if (sizeof($gmdatas)) |
if (sizeof($gmdatas)) |
186 |
$graph->Stroke($file); |
{ |
187 |
|
$graph = new Graph($width, $height,"auto"); |
188 |
|
$graph->SetScale("textlin"); |
189 |
|
|
190 |
|
$graph->yaxis->scale->SetGrace(2); |
191 |
|
$graph->SetFrame(1); |
192 |
|
$graph->img->SetMargin(40,20,20,35); |
193 |
|
|
194 |
|
$b2plot = new BarPlot($gmdatas); |
195 |
|
$b2plot->SetFillColor("blue"); |
196 |
|
|
197 |
|
$graph->title->Set("Consommation par mois"); |
198 |
|
|
199 |
|
$graph->xaxis->SetTickLabels($gmlabels); |
200 |
|
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); |
201 |
|
|
202 |
|
$graph->Add($b2plot); |
203 |
|
$graph->img->SetImgFormat("png"); |
204 |
|
|
205 |
|
$file= DOL_DATA_ROOT."/energie/graph/month.".$obj_c->rowid.".png"; |
206 |
|
|
207 |
|
$graph->Stroke($file); |
208 |
|
} |
209 |
// Hebdomadaire |
// Hebdomadaire |
210 |
$width = 750; |
$width = 750; |
211 |
$height = 300; |
$height = 300; |
216 |
$gwlabels[$i] = substr($key,0,2); |
$gwlabels[$i] = substr($key,0,2); |
217 |
$i++; |
$i++; |
218 |
} |
} |
|
|
|
|
$graph = new Graph($width, $height,"auto"); |
|
|
$graph->SetScale("textlin"); |
|
|
|
|
|
$graph->yaxis->scale->SetGrace(2); |
|
|
$graph->SetFrame(1); |
|
|
$graph->img->SetMargin(40,20,20,35); |
|
|
|
|
|
$b2plot = new BarPlot($gwdatas); |
|
|
$graph->xaxis->SetTickLabels($gwlabels); |
|
|
|
|
|
$b2plot->SetFillColor("blue"); |
|
|
$graph->title->Set("Consommation par semaine"); |
|
|
|
|
|
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); |
|
|
|
|
|
$graph->Add($b2plot); |
|
|
|
|
|
$graph->img->SetImgFormat("png"); |
|
|
|
|
|
$file= DOL_DATA_ROOT."/energie/graph/week.".$obj_c->rowid.".png"; |
|
|
|
|
219 |
if (sizeof($gwdatas)) |
if (sizeof($gwdatas)) |
220 |
$graph->Stroke($file); |
{ |
221 |
|
$graph = new Graph($width, $height,"auto"); |
222 |
|
$graph->SetScale("textlin"); |
223 |
|
|
224 |
|
$graph->yaxis->scale->SetGrace(2); |
225 |
|
$graph->SetFrame(1); |
226 |
|
$graph->img->SetMargin(40,20,20,35); |
227 |
|
|
228 |
|
$b2plot = new BarPlot($gwdatas); |
229 |
|
$graph->xaxis->SetTickLabels($gwlabels); |
230 |
|
|
231 |
|
$b2plot->SetFillColor("blue"); |
232 |
|
$graph->title->Set("Consommation par semaine"); |
233 |
|
|
234 |
|
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); |
235 |
|
|
236 |
|
$graph->Add($b2plot); |
237 |
|
|
238 |
|
$graph->img->SetImgFormat("png"); |
239 |
|
|
240 |
|
$file= DOL_DATA_ROOT."/energie/graph/week.".$obj_c->rowid.".png"; |
241 |
|
|
242 |
|
$graph->Stroke($file); |
243 |
|
} |
244 |
|
|
245 |
// Annuel |
// Annuel |
246 |
$width = 450; |
$width = 450; |
252 |
$gylabels[$i] = $key; |
$gylabels[$i] = $key; |
253 |
$i++; |
$i++; |
254 |
} |
} |
255 |
|
|
|
$graph = new Graph($width, $height,"auto"); |
|
|
$graph->SetScale("textlin"); |
|
|
|
|
|
$graph->yaxis->scale->SetGrace(2); |
|
|
$graph->SetFrame(1); |
|
|
$graph->img->SetMargin(40,20,20,35); |
|
|
|
|
|
$b2plot = new BarPlot($gydatas); |
|
|
$graph->xaxis->SetTickLabels($gylabels); |
|
|
|
|
|
$b2plot->SetFillColor("blue"); |
|
|
$graph->title->Set("Consommation annuelle"); |
|
|
|
|
|
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); |
|
|
|
|
|
$graph->Add($b2plot); |
|
|
|
|
|
$graph->img->SetImgFormat("png"); |
|
|
|
|
|
$file= DOL_DATA_ROOT."/energie/graph/year.".$obj_c->rowid.".png"; |
|
|
|
|
256 |
if (sizeof($gydatas)) |
if (sizeof($gydatas)) |
257 |
$graph->Stroke($file); |
{ |
258 |
|
$graph = new Graph($width, $height,"auto"); |
259 |
|
$graph->SetScale("textlin"); |
260 |
|
|
261 |
|
$graph->yaxis->scale->SetGrace(2); |
262 |
|
$graph->SetFrame(1); |
263 |
|
$graph->img->SetMargin(40,20,20,35); |
264 |
|
|
265 |
|
$b2plot = new BarPlot($gydatas); |
266 |
|
$graph->xaxis->SetTickLabels($gylabels); |
267 |
|
|
268 |
|
$b2plot->SetFillColor("blue"); |
269 |
|
$graph->title->Set("Consommation annuelle"); |
270 |
|
|
271 |
|
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); |
272 |
|
|
273 |
|
$graph->Add($b2plot); |
274 |
|
|
275 |
|
$graph->img->SetImgFormat("png"); |
276 |
|
|
277 |
|
$file= DOL_DATA_ROOT."/energie/graph/year.".$obj_c->rowid.".png"; |
278 |
|
|
279 |
|
$graph->Stroke($file); |
280 |
|
} |
281 |
} |
} |
282 |
else |
else |
283 |
{ |
{ |
368 |
$graph->xaxis->SetTickLabels($gylabels); |
$graph->xaxis->SetTickLabels($gylabels); |
369 |
$graph->Add($gbplot); |
$graph->Add($gbplot); |
370 |
|
|
371 |
$file= DOL_DATA_ROOT."/energie/graph/groupe.week.".$row_g[0].".png"; |
$file= DOL_DATA_ROOT."/energie/graph/groupe.week.".$row_g[0].".png"; |
372 |
$graph->Stroke($file); |
if (sizeof($gbspl)) |
373 |
|
$graph->Stroke($file); |
374 |
// |
// |
375 |
// |
// |
376 |
// |
// |
411 |
$graph->Add($gbplot); |
$graph->Add($gbplot); |
412 |
|
|
413 |
$file= DOL_DATA_ROOT."/energie/graph/groupe.month.".$row_g[0].".png"; |
$file= DOL_DATA_ROOT."/energie/graph/groupe.month.".$row_g[0].".png"; |
414 |
$graph->Stroke($file); |
if (sizeof($gbspl)) |
415 |
|
$graph->Stroke($file); |
416 |
// |
// |
417 |
// |
// |
418 |
// |
// |
453 |
$graph->Add($gbplot); |
$graph->Add($gbplot); |
454 |
|
|
455 |
$file= DOL_DATA_ROOT."/energie/graph/groupe.year.".$row_g[0].".png"; |
$file= DOL_DATA_ROOT."/energie/graph/groupe.year.".$row_g[0].".png"; |
456 |
$graph->Stroke($file); |
if (sizeof($gbspl)) |
457 |
|
$graph->Stroke($file); |
458 |
// |
// |
459 |
} |
} |
460 |
else |
else |