2010-10-4 Miguel de Dios <miguel.dedios@artica.es>

* include/pChart/pChart.class: merge bugfixes from the proyect
	"Babel Enterprise" fixing by Dario Rodriguez <dario.rodriguez@artica.es>.
	
	* include/fgraph.php: fixed undefined var $max_value in function
	"graphic_combined_module".



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3334 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-10-04 11:49:55 +00:00
parent 512d534d13
commit c1e181cd0f
3 changed files with 26 additions and 5 deletions

View File

@ -1,3 +1,11 @@
2010-10-4 Miguel de Dios <miguel.dedios@artica.es>
* include/pChart/pChart.class: merge bugfixes from the proyect
"Babel Enterprise" fixing by Dario Rodriguez <dario.rodriguez@artica.es>.
* include/fgraph.php: fixed undefined var $max_value in function
"graphic_combined_module".
2010-10-04 Ramon Novoa <rnovoa@artica.es> 2010-10-04 Ramon Novoa <rnovoa@artica.es>
* operation/agentes/estado_generalagente.php: Properly initialize the * operation/agentes/estado_generalagente.php: Properly initialize the

View File

@ -343,6 +343,9 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$engine->xaxis_interval = $resolution; $engine->xaxis_interval = $resolution;
$events = false; $events = false;
$alerts = false; $alerts = false;
if (!isset($max_value)) {
$max_value = 0;
}
$engine->combined_graph ($graph, $events, $alerts, $unit_name, $max_value, $stacked); $engine->combined_graph ($graph, $events, $alerts, $unit_name, $max_value, $stacked);
} }

View File

@ -475,13 +475,17 @@
$Scale1 = ( $this->VMax - $this->VMin ) / $Factor; $Scale1 = ( $this->VMax - $this->VMin ) / $Factor;
$Scale2 = ( $this->VMax - $this->VMin ) / $Factor / 2; $Scale2 = ( $this->VMax - $this->VMin ) / $Factor / 2;
$Scale4 = ( $this->VMax - $this->VMin ) / $Factor / 4; $Scale4 = ( $this->VMax - $this->VMin ) / $Factor / 4;
if ($Scale1 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = max(floor($Scale1),1); $Scale = 1;} if ($Scale1 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = max(floor($Scale1),1); $Scale = 1;}
if ($Scale2 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = max(floor($Scale2),1); $Scale = 2;} if ($Scale2 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = max(floor($Scale2),1); $Scale = 2;}
if (!$ScaleOk) if (!$ScaleOk)
{ {
if ( $Scale2 > 1 ) { $Factor = $Factor * 10; } //Fixed because in some cases throughts a division
if ( $Scale2 < 1 ) { $Factor = $Factor / 10; } //by zero error.
//if ( $Scale2 > 1 ) { $Factor = $Factor * 10; }
//if ( $Scale2 < 1 ) { $Factor = $Factor / 10; }
if ( $Scale2 > 1 ) { $Factor = $Factor * (2 * $MaxDivs); }
if ( $Scale2 < 1 ) { $Factor = $Factor / (2 * $MaxDivs); }
} }
} }
@ -511,8 +515,12 @@
else else
$Divisions = $this->Divisions; $Divisions = $this->Divisions;
$this->DivisionCount = $Divisions; //This lines patch the error division by zero in some cases.
if ($Divisions == 0)
$Divisions = 1;
$this->DivisionCount = $Divisions;
$DataRange = $this->VMax - $this->VMin; $DataRange = $this->VMax - $this->VMin;
if ( $DataRange == 0 ) { $DataRange = .1; } if ( $DataRange == 0 ) { $DataRange = .1; }
@ -3144,7 +3152,9 @@
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; } if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
$Distance = sqrt(($X2-$X1)*($X2-$X1)+($Y2-$Y1)*($Y2-$Y1)); $Distance = sqrt(($X2-$X1)*($X2-$X1)+($Y2-$Y1)*($Y2-$Y1));
if ($Distance == 0) {
$Distance = 1;
}
$XStep = ($X2-$X1) / $Distance; $XStep = ($X2-$X1) / $Distance;
$YStep = ($Y2-$Y1) / $Distance; $YStep = ($Y2-$Y1) / $Distance;