diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index d6fbf44f91..98ec716012 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2011-04-26 Sergio Martin + + * include/graphs/functions_pchart.php + include/graphs/functions_gd.php + include/graphs/fgraph.php: Merged sancho works from + integria passing fonts and sizes in integria. Little + fixes + 2011-04-25 Javier Lanz * include/functions_reporting.php: Fixed a small font problem displaying diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index db85c18491..c1c877cecb 100755 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -134,7 +134,7 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array() function threshold_graph($flash_chart, $chart_data, $width, $height) { if($flash_chart) { - echo fs_2d_column_chart ($chart_data, $width, $height); + echo fs_area_chart ($chart_data, $width, $height); } else { echo ""; diff --git a/pandora_console/include/graphs/functions_gd.php b/pandora_console/include/graphs/functions_gd.php index 6c1c7f6d63..421c0ccb97 100755 --- a/pandora_console/include/graphs/functions_gd.php +++ b/pandora_console/include/graphs/functions_gd.php @@ -40,6 +40,10 @@ if($id_graph) { exit; } + if (!isset($graph['fontsize'])) { + $graph['fontsize'] = 6; + } + $graph_type = get_parameter('graph_type', ''); switch($graph_type) { @@ -50,7 +54,8 @@ if($id_graph) { json_decode($graph['data'], true), $graph['max'], $graph['font'], - $graph['title']); + $graph['title'], + $graph['fontsize']); break; case 'progressbar': gd_progress_bar ($graph['width'], @@ -60,13 +65,14 @@ if($id_graph) { $graph['font'], $graph['out_of_lim_str'], $graph['out_of_lim_image'], - $graph['mode']); + $graph['mode'], + $graph['fontsize']); break; } } -function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title) { +function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title, $fontsize = 8) { // $title is for future use $nvalues = count($data); @@ -112,7 +118,7 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title) foreach($data as $label => $value) { ImageFilledRectangle($image, $leftmargin, $margin_up, ($value/$size_per)+$leftmargin, $margin_up+$rectangle_height -1 , $colors[$c]); if ($mode != 2) { - ImageTTFText($image, 7, 0, 0, $margin_up+8, $black, $font, $label); + ImageTTFText($image, $fontsize, 0, 0, $margin_up+8, $black, $font, $label); } $margin_up += $rectangle_height + 1; @@ -131,9 +137,9 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title) imageline($image, $risk_low, 0, $risk_low , $height, $grey); imageline($image, $risk_med , 0, $risk_med , $height, $grey); imageline($image, $risk_high, 0, $risk_high , $height, $grey); - ImageTTFText($image, 7, 0, $risk_low-20, $height, $grey, $font, "Low"); - ImageTTFText($image, 7, 0, $risk_med-20, $height, $grey, $font, "Med."); - ImageTTFText($image, 7, 0, $risk_high-25, $height, $grey, $font, "High"); + ImageTTFText($image, $fontsize, 0, $risk_low-20, $height, $grey, $font, "Low"); + ImageTTFText($image, $fontsize, 0, $risk_med-20, $height, $grey, $font, "Med."); + ImageTTFText($image, $fontsize, 0, $risk_high-25, $height, $grey, $font, "High"); } imagePNG($image); imagedestroy($image); @@ -143,7 +149,7 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title) // Draw a dynamic progress bar using GDlib directly // *************************************************************************** -function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1) { +function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10) { if($out_of_lim_str === false) { $out_of_lim_str = "Out of limits"; } @@ -214,11 +220,11 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim if ($rating > 50) if ($rating > 100) - ImageTTFText($image, 8, 0, ($width/4), ($height/2)+($height/5), $back, $font, $out_of_lim_str); + ImageTTFText($image, $fontsize, 0, ($width/4), ($height/2)+($height/5), $back, $font, $out_of_lim_str); else - ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $font, $rating."%"); + ImageTTFText($image, $fontsize, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $font, $rating."%"); else - ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $text, $font, $rating."%"); + ImageTTFText($image, $fontsize, 0, ($width/2)-($width/10), ($height/2)+($height/5), $text, $font, $rating."%"); break; } imagePNG($image); diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 005798bfbb..616ebd9921 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; - debugPrint($water_mark, true); 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; } } - debugPrint($max_chars, true); $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,