Optimisation des graph
This commit is contained in:
parent
9f8a2a6537
commit
355f1075ad
@ -145,7 +145,8 @@ if ($resql_c)
|
|||||||
|
|
||||||
$width = 750;
|
$width = 750;
|
||||||
$height = 300;
|
$height = 300;
|
||||||
|
if (sizeof($gdatas) > 2)
|
||||||
|
{
|
||||||
$graph = new Graph($width, $height,"auto");
|
$graph = new Graph($width, $height,"auto");
|
||||||
$graph->SetScale("textlin",0,$maxa);
|
$graph->SetScale("textlin",0,$maxa);
|
||||||
|
|
||||||
@ -168,9 +169,8 @@ if ($resql_c)
|
|||||||
|
|
||||||
$file= DOL_DATA_ROOT."/energie/graph/day.".$obj_c->rowid.".png";
|
$file= DOL_DATA_ROOT."/energie/graph/day.".$obj_c->rowid.".png";
|
||||||
|
|
||||||
if (sizeof($gdatas) > 2)
|
|
||||||
$graph->Stroke($file);
|
$graph->Stroke($file);
|
||||||
|
}
|
||||||
$width = 450;
|
$width = 450;
|
||||||
$height = 300;
|
$height = 300;
|
||||||
|
|
||||||
@ -182,7 +182,8 @@ if ($resql_c)
|
|||||||
$gmlabels[$i] = $key;
|
$gmlabels[$i] = $key;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
if (sizeof($gmdatas))
|
||||||
|
{
|
||||||
$graph = new Graph($width, $height,"auto");
|
$graph = new Graph($width, $height,"auto");
|
||||||
$graph->SetScale("textlin");
|
$graph->SetScale("textlin");
|
||||||
|
|
||||||
@ -191,7 +192,6 @@ if ($resql_c)
|
|||||||
$graph->img->SetMargin(40,20,20,35);
|
$graph->img->SetMargin(40,20,20,35);
|
||||||
|
|
||||||
$b2plot = new BarPlot($gmdatas);
|
$b2plot = new BarPlot($gmdatas);
|
||||||
|
|
||||||
$b2plot->SetFillColor("blue");
|
$b2plot->SetFillColor("blue");
|
||||||
|
|
||||||
$graph->title->Set("Consommation par mois");
|
$graph->title->Set("Consommation par mois");
|
||||||
@ -200,14 +200,12 @@ if ($resql_c)
|
|||||||
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time()));
|
$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time()));
|
||||||
|
|
||||||
$graph->Add($b2plot);
|
$graph->Add($b2plot);
|
||||||
|
|
||||||
$graph->img->SetImgFormat("png");
|
$graph->img->SetImgFormat("png");
|
||||||
|
|
||||||
$file= DOL_DATA_ROOT."/energie/graph/month.".$obj_c->rowid.".png";
|
$file= DOL_DATA_ROOT."/energie/graph/month.".$obj_c->rowid.".png";
|
||||||
|
|
||||||
if (sizeof($gmdatas))
|
|
||||||
$graph->Stroke($file);
|
$graph->Stroke($file);
|
||||||
|
}
|
||||||
// Hebdomadaire
|
// Hebdomadaire
|
||||||
$width = 750;
|
$width = 750;
|
||||||
$height = 300;
|
$height = 300;
|
||||||
@ -218,7 +216,8 @@ if ($resql_c)
|
|||||||
$gwlabels[$i] = substr($key,0,2);
|
$gwlabels[$i] = substr($key,0,2);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
if (sizeof($gwdatas))
|
||||||
|
{
|
||||||
$graph = new Graph($width, $height,"auto");
|
$graph = new Graph($width, $height,"auto");
|
||||||
$graph->SetScale("textlin");
|
$graph->SetScale("textlin");
|
||||||
|
|
||||||
@ -240,8 +239,8 @@ if ($resql_c)
|
|||||||
|
|
||||||
$file= DOL_DATA_ROOT."/energie/graph/week.".$obj_c->rowid.".png";
|
$file= DOL_DATA_ROOT."/energie/graph/week.".$obj_c->rowid.".png";
|
||||||
|
|
||||||
if (sizeof($gwdatas))
|
|
||||||
$graph->Stroke($file);
|
$graph->Stroke($file);
|
||||||
|
}
|
||||||
|
|
||||||
// Annuel
|
// Annuel
|
||||||
$width = 450;
|
$width = 450;
|
||||||
@ -254,6 +253,8 @@ if ($resql_c)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sizeof($gydatas))
|
||||||
|
{
|
||||||
$graph = new Graph($width, $height,"auto");
|
$graph = new Graph($width, $height,"auto");
|
||||||
$graph->SetScale("textlin");
|
$graph->SetScale("textlin");
|
||||||
|
|
||||||
@ -275,9 +276,9 @@ if ($resql_c)
|
|||||||
|
|
||||||
$file= DOL_DATA_ROOT."/energie/graph/year.".$obj_c->rowid.".png";
|
$file= DOL_DATA_ROOT."/energie/graph/year.".$obj_c->rowid.".png";
|
||||||
|
|
||||||
if (sizeof($gydatas))
|
|
||||||
$graph->Stroke($file);
|
$graph->Stroke($file);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Erreur SQL");
|
dolibarr_syslog("Erreur SQL");
|
||||||
@ -368,6 +369,7 @@ if ($resql_g)
|
|||||||
$graph->Add($gbplot);
|
$graph->Add($gbplot);
|
||||||
|
|
||||||
$file= DOL_DATA_ROOT."/energie/graph/groupe.week.".$row_g[0].".png";
|
$file= DOL_DATA_ROOT."/energie/graph/groupe.week.".$row_g[0].".png";
|
||||||
|
if (sizeof($gbspl))
|
||||||
$graph->Stroke($file);
|
$graph->Stroke($file);
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@ -409,6 +411,7 @@ if ($resql_g)
|
|||||||
$graph->Add($gbplot);
|
$graph->Add($gbplot);
|
||||||
|
|
||||||
$file= DOL_DATA_ROOT."/energie/graph/groupe.month.".$row_g[0].".png";
|
$file= DOL_DATA_ROOT."/energie/graph/groupe.month.".$row_g[0].".png";
|
||||||
|
if (sizeof($gbspl))
|
||||||
$graph->Stroke($file);
|
$graph->Stroke($file);
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@ -450,6 +453,7 @@ if ($resql_g)
|
|||||||
$graph->Add($gbplot);
|
$graph->Add($gbplot);
|
||||||
|
|
||||||
$file= DOL_DATA_ROOT."/energie/graph/groupe.year.".$row_g[0].".png";
|
$file= DOL_DATA_ROOT."/energie/graph/groupe.year.".$row_g[0].".png";
|
||||||
|
if (sizeof($gbspl))
|
||||||
$graph->Stroke($file);
|
$graph->Stroke($file);
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user