From b5904ecbcc1a9e5b767017dae56153c6b8f2e919 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 20 Jun 2013 12:59:22 +0000 Subject: [PATCH] 2013-06-20 Miguel de Dios * include/graphs/functions_pchart.php: fixed the graphs with all values in negative Y axis. Now it shows correct. Fixes: #2302 MERGED FROM THE BRANCH PANDORA_4.0 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8367 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 +++++++++ pandora_console/include/graphs/functions_pchart.php | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 59565beb0a..eb2ab98837 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2013-06-20 Miguel de Dios + + * include/graphs/functions_pchart.php: fixed the graphs with all + values in negative Y axis. Now it shows correct. + + Fixes: #2302 + + MERGED FROM THE BRANCH PANDORA_4.0 + 2013-06-20 Miguel de Dios * include/graphs/fgraph.php, include/graphs/functions_pchart.php: diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 49c8bf4ac6..f8f3cd6909 100755 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -789,18 +789,25 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, /*Get minimun value to draw axis properly*/ $min_data = min(min($data)); + $ManualScale = array(); $mode = SCALE_MODE_START0; if ($min_data < 0) { $mode = SCALE_MODE_FLOATING; } + if ($max_data < 0) { + $ManualScale = array(0 => array("Min" => $min_data, "Max" => 0)); + $mode = SCALE_MODE_MANUAL; + } + /* Draw the scale */ $scaleSettings = array("GridR"=>200, "GridG"=>200, "GridB"=>200, "DrawSubTicks"=>TRUE, "CycleBackground"=>TRUE, - "Mode" => $mode, + "Mode" => $mode, + "ManualScale" => $ManualScale, "LabelRotation" => 40, "XMargin" => 0, "MinDivHeight" => 20,