2012-05-31 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/graphs/functions_pchart.php
	 include/graphs/pChart/pDraw.class.php: Graphs with all data equal 
	 to zero are displayed correctly.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6390 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2012-05-31 14:37:34 +00:00
parent 07a341d4c2
commit 821806dc75
3 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2012-05-31 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/graphs/functions_pchart.php
include/graphs/pChart/pDraw.class.php: Graphs with all data equal
to zero are displayed correctly.
2012-05-31 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* godmode/reporting/reporting_builder.php: Fixed error updating

View File

@ -707,11 +707,16 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
// Get the max number of scale
$max_all = 0;
$serie_ne_zero = false;
foreach($data as $serie) {
$max_this_serie = max($serie);
if($max_this_serie > $max_all) {
$max_all = $max_this_serie;
}
// Detect if all serie is equal to zero or not
if ($serie != 0)
$serie_ne_zero = true;
}
// Get the number of digits of the scale
@ -722,7 +727,8 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
}
// If the number is less than 1 we count the decimals
if($digits_left == 0){
// Also check if the serie is not all equal to zero (!$serie_ne_zero)
if($digits_left == 0 and !$serie_ne_zero) {
while($max_all < 1) {
$digits_left ++;
$max_all *= 10;

View File

@ -1808,7 +1808,13 @@
$AutoMargin = (($AxisMax-$AxisMin)/100)*$XReleasePercent;
$Data["Axis"][$AxisID]["Min"] = $AxisMin-$AutoMargin; $Data["Axis"][$AxisID]["Max"] = $AxisMax+$AutoMargin;
if ( $Mode == SCALE_MODE_START0 ) { $Data["Axis"][$AxisID]["Min"] = 0; }
if ( $Mode == SCALE_MODE_START0 ) {
$Data["Axis"][$AxisID]["Min"] = 0;
// Hack: When max and min graph values are equal to zero then force max = 1
if($Data["Axis"][$AxisID]["Max"] == 0) {
$Data["Axis"][$AxisID]["Max"] = 1;
}
}
}
elseif ( $Mode == SCALE_MODE_MANUAL )
{