diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index b5c8567b2b..d5e5fa9bb2 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1773,10 +1773,12 @@ function graphic_combined_module ($module_list, $weight_list, $period, } */ + if($config["fixed_graph"] == false){ + $water_mark = array( + 'file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); + } - $water_mark = array( - 'file' => $config['homedir'] . "/images/logo_vertical_water.png", - 'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)); //Work around for fixed the agents name with huge size chars. diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 93f25ad93f..8927d87420 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -5962,7 +5962,7 @@ function reporting_simple_graph($report, $content, $type = 'dinamic', false, $width, $height, - '
' . $label, + $label, '', false, $only_avg, @@ -5987,7 +5987,7 @@ function reporting_simple_graph($report, $content, $type = 'dinamic', false, $width, $height, - '
' . $label, + $label, '', false, $only_avg, diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 14dc2e96eb..68c1958c45 100644 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -749,6 +749,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, "GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60); $margin_left = 40; + $margin_right = 0; $margin_top = 10; $margin_bottom = 3 * $max_chars; break; @@ -757,24 +758,14 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, "CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM, "LabelValuesRotation" => 30); $margin_left = $font_size * $max_chars; + $margin_right = 15; $margin_top = 40; $margin_bottom = 10; break; } - $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]; - $water_mark_width = $size_water_mark[0]; - - $myPicture->drawFromPNG(($width - $water_mark_width), - ($height - $water_mark_height) - $margin_bottom, $water_mark); - } - /* Define the chart area */ - $myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom); + $myPicture->setGraphArea($margin_left, $margin_top, $width - $margin_right, $height - $margin_bottom); $myPicture->drawScale($scaleSettings); /* @@ -792,6 +783,15 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $myPicture->drawBarChart($settings); + // Paint the water mark at the last moment to show it in front + if (!empty($water_mark)) { + $size_water_mark = getimagesize($water_mark); + $water_mark_width = $size_water_mark[0]; + + $myPicture->drawFromPNG(($width - $water_mark_width - $margin_right), + $margin_top, $water_mark); + } + /* Render the picture */ $myPicture->stroke(); } @@ -907,7 +907,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, } /* Create the pChart object */ - $myPicture = new pImage($width, $height, $MyData, $transparent, + $myPicture = new pImage($width, $height + $font_size, $MyData, $transparent, $backgroundColor, $fontColor); /* Turn of Antialiasing */ @@ -920,6 +920,8 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $myPicture->setFontProperties( array("FontName" =>$font, "FontSize" => $font_size)); + // By default, set a top margin of 5 px + $top_margin = 5; if (isset($legend)) { /* Set horizontal legend if is posible */ $legend_mode = LEGEND_HORIZONTAL; @@ -930,6 +932,9 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode)); } + // Update the top margin to add the legend Height + $top_margin = $size['Height']; + /* Write the chart legend */ $myPicture->drawLegend($width - $size['Width'], 8, array("Style" => LEGEND_NOBORDER, "Mode" => $legend_mode)); @@ -948,7 +953,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $myPicture->drawFromPNG( ($width - $water_mark_width), - ($height - $water_mark_height) - $margin_bottom, + $top_margin, $water_mark); } @@ -999,20 +1004,9 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $chart_size = $default_chart_size; } - if (isset($size['Height'])) { - /* Define the chart area */ - //if ($yaxisname != '') { - //} - $myPicture->setGraphArea($chart_size, $size['Height'], - ($width - $water_mark_width), - ($height - $margin_bottom)); - } - else { - /* Define the chart area */ - $myPicture->setGraphArea($chart_size, 5, - ($width - $water_mark_width), - ($height - $margin_bottom)); - } + $myPicture->setGraphArea($chart_size, $top_margin, + $width, + ($height - $margin_bottom)); /*Get minimun value to draw axis properly*/ $min_data = min(min($data));