2011-05-03 Sergio Martin <sergio.martin@artica.es>

* 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
This commit is contained in:
zarzuelo 2011-05-03 11:23:24 +00:00
parent 5ffb96ebd5
commit d995cb010a
2 changed files with 12 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2011-05-03 Sergio Martin <sergio.martin@artica.es>
* include/graphs/functions_pchart.php: Clean code
merged from integria library
2011-05-02 SAncho Lerena <slerena@artica.es> 2011-05-02 SAncho Lerena <slerena@artica.es>
* include/help/en/help_reporting_advanced_tab.php, * include/help/en/help_reporting_advanced_tab.php,

View File

@ -42,6 +42,7 @@ $yaxisname = '';
$legend = null; $legend = null;
$colors = null; $colors = null;
$font_size = 8; $font_size = 8;
$force_steps = true;
$graph_type = get_parameter('graph_type', ''); $graph_type = get_parameter('graph_type', '');
@ -61,18 +62,16 @@ if (!isset($graph)) {
$data = $graph['data']; $data = $graph['data'];
$width = $graph['width']; $width = $graph['width'];
$height = $graph['height']; $height = $graph['height'];
$colors = null;
$force_steps = true; if (isset($graph['color'])) {
if (isset($graph['color']))
$colors = $graph['color']; $colors = $graph['color'];
$legend = null; }
if (isset($graph['legend'])) if (isset($graph['legend'])) {
$legend = $graph['legend']; $legend = $graph['legend'];
$xaxisname = ''; }
if(isset($graph['xaxisname'])) { if(isset($graph['xaxisname'])) {
$xaxisname = $graph['xaxisname']; $xaxisname = $graph['xaxisname'];
} }
$yaxisname = '';
if(isset($graph['yaxisname'])) { if(isset($graph['yaxisname'])) {
$yaxisname = $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_height = 0;
$water_mark_width = 0; $water_mark_width = 0;
if (!empty($water_mark)) { if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark); $size_water_mark = getimagesize($water_mark);
$water_mark_height = $size_water_mark[1]; $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; $max_chars = $len;
} }
} }
$legend_with_aprox = 32 + (7 * $max_chars); $legend_with_aprox = 32 + (7 * $max_chars);
$PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10)); $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); "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60);
$margin_left = 40; $margin_left = 40;
$margin_top = 10; $margin_top = 10;
$margin_bottom = 8 * $max_chars; $margin_bottom = 10 * $max_chars;
break; break;
case "hbar": case "hbar":
$scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE, $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,