From f72919477019f303a1a60167cde09e38af055bfa Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 3 May 2011 11:23:24 +0000 Subject: [PATCH] 2011-05-03 Sergio Martin * include/graphs/functions_pchart.php: Clean code merged from integria library git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4295 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++++ .../include/graphs/functions_pchart.php | 17 +++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b0e5423d4d..9104a3e932 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2011-05-03 Sergio Martin + + * include/graphs/functions_pchart.php: Clean code + merged from integria library + 2011-05-02 SAncho Lerena * include/help/en/help_reporting_advanced_tab.php, diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index bc1c523cb3..f15a3a721c 100755 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -42,6 +42,7 @@ $yaxisname = ''; $legend = null; $colors = null; $font_size = 8; +$force_steps = true; $graph_type = get_parameter('graph_type', ''); @@ -61,18 +62,16 @@ if (!isset($graph)) { $data = $graph['data']; $width = $graph['width']; $height = $graph['height']; -$colors = null; -$force_steps = true; -if (isset($graph['color'])) + +if (isset($graph['color'])) { $colors = $graph['color']; -$legend = null; -if (isset($graph['legend'])) +} +if (isset($graph['legend'])) { $legend = $graph['legend']; -$xaxisname = ''; +} if(isset($graph['xaxisname'])) { $xaxisname = $graph['xaxisname']; } -$yaxisname = ''; if(isset($graph['yaxisname'])) { $yaxisname = $graph['yaxisname']; } @@ -377,7 +376,6 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $water_mark_height = 0; $water_mark_width = 0; - if (!empty($water_mark)) { $size_water_mark = getimagesize($water_mark); $water_mark_height = $size_water_mark[1]; @@ -412,7 +410,6 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $max_chars = $len; } } - $legend_with_aprox = 32 + (7 * $max_chars); $PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10)); @@ -554,7 +551,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60); $margin_left = 40; $margin_top = 10; - $margin_bottom = 8 * $max_chars; + $margin_bottom = 10 * $max_chars; break; case "hbar": $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,