From dbf8baa429592163ec6b7d545bc9968c890e7516 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 20 Apr 2011 16:57:06 +0000 Subject: [PATCH] 2011-04-20 Miguel de Dios * include/functions_graph.php, include/graphs/functions_pchart.php: some fixes, and set font size equal for all text in graphs. And starte the change to vertical bar the graph for string module. * include/functions_reporting.php: added to take the font and size. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4273 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 +++++++ pandora_console/include/functions_graph.php | 26 +++++++++++-------- .../include/functions_reporting.php | 17 ++++++++---- .../include/graphs/functions_pchart.php | 8 +++--- 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c7686996ff..0811f577a2 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2011-04-20 Miguel de Dios + + * include/functions_graph.php, + include/graphs/functions_pchart.php: some fixes, and set font size equal + for all text in graphs. And starte the change to vertical bar the graph + for string module. + + * include/functions_reporting.php: added to take the font and size. + 2011-04-20 Ramon Novoa * include/help/en/help_alert_macros.php, diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 6122c76bbb..eb85f9aa45 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -635,7 +635,7 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width, if ($only_image) { $flash_charts = false; } - $flash_charts = false; + switch ($stacked) { case GRAPH_AREA: $color = null; @@ -1484,7 +1484,7 @@ function grafico_modulo_boolean2 ($agent_module_id, $period, $show_events, // Get event data (contains alert data too) if ($show_events == 1 || $show_alerts == 1) { - $events = get_db_all_rows_filter ('tevento', + $events = db_get_all_rows_filter('tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", @@ -1496,7 +1496,7 @@ function grafico_modulo_boolean2 ($agent_module_id, $period, $show_events, } // Get module data - $data = get_db_all_rows_filter ('tagente_datos', + $data = db_get_all_rows_filter ('tagente_datos', array ('id_agente_modulo' => $agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", @@ -1798,7 +1798,7 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events, // Get event data (contains alert data too) if ($show_events == 1 || $show_alerts == 1) { - $events = get_db_all_rows_filter ('tevento', + $events = db_get_all_rows_filter ('tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", @@ -1810,7 +1810,7 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events, } // Get module data - $data = get_db_all_rows_filter ('tagente_datos_string', + $data = db_get_all_rows_filter ('tagente_datos_string', array ('id_agente_modulo' => $agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", @@ -1963,12 +1963,8 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events, ///////////////////////////////////////////////////////////////////////////////////////// $color = array(); $color['sum'] = array('border' => '#000000', 'color' => $config['graph_color2'], 'alpha' => 50); - if($show_events) { - $color['event'] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50); - } - if($show_alerts) { - $color['alert'] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50); - } + $color['event'] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50); + $color['alert'] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50); $color['max'] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50); $color['min'] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 50); //$color['baseline'] = array('border' => null, 'color' => '#0097BD', 'alpha' => 10); @@ -1981,6 +1977,14 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events, $legend = null; + //TODO FIX + + return vbar_graph($flash_chart, $chart, $width, $height, $color, + $legend, "", "", $homeurl, + $config['homedir'] . "/images/logo_vertical_water.png", + $config['fontpath'], $config['font_size']); + + //old return area_graph($flash_chart, $chart, $width, $height, $color, $legend, $long_index, "images/image_problem.opaque.png", "", "", $homeurl, $config['homedir'] . "/images/logo_vertical_water.png", diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 4939ce567d..c1d896b2ea 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1203,7 +1203,9 @@ function alert_reporting ($id_group, $period = 0, $date = 0, $return = false) { $data[__('Alerts fired')] = $fired_percentage; $data[__('Alerts not fired')] = $not_fired_percentage; - $output .= pie3d_graph($config['flash_charts'], $data, 280, 150); + $output .= pie3d_graph($config['flash_charts'], $data, 280, 150, + __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", + $config['fontpath'], $config['font_size']); $output .= ''.__('Alerts fired').': '.sizeof ($alerts_fired).'
'; $output .= ''.__('Total alerts monitored').': '.sizeof ($alerts).'
'; @@ -1275,7 +1277,9 @@ function monitor_health_reporting ($id_group, $period = 0, $date = 0, $return = $data[__('Monitors OK')] = $down_percentage; $data[__('Monitors BAD')] = $not_down_percentage; - $output .= pie3d_graph($config['flash_charts'], $data, 280, 150); + $output .= pie3d_graph($config['flash_charts'], $data, 280, 150, + __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", + $config['fontpath'], $config['font_size']); if (!$return) echo $output; @@ -2125,7 +2129,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data_pie_graph = json_encode ($data_graph); if (($show_graph == 1 || $show_graph == 2) && !empty($slas)) { $data[0] = pie3d_graph($config['flash_charts'], $data_graph, - 500, 150, __("other")); + 500, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", + $config['fontpath'], $config['font_size']); array_push ($table->data, $data); //Display horizontal bar graphs @@ -3080,7 +3085,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array(); if ($show_graph == 1 || $show_graph == 2) { $data[0] = pie3d_graph($config['flash_charts'], $data_pie_graph, - 600, 150, __("other")); + 600, 150, __("other"),"", $config['homedir'] . "/images/logo_vertical_water.png", + $config['fontpath'], $config['font_size']); array_push ($table->data, $data); //Display bars graph @@ -3328,7 +3334,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array(); if ($show_graph == 1 || $show_graph == 2) { $data[0] = pie3d_graph($config['flash_charts'], $data_graph, - 600, 150, __("other")); + 600, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", + $config['fontpath'], $config['font_size']); array_push ($table->data, $data); //Display bars graph $table->colspan[4][0] = 3; diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index c6e80085bd..eb972fbbc1 100755 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -452,12 +452,12 @@ function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width, "LabelMiddle"=>FALSE,"Layout"=>RADAR_LAYOUT_STAR, "BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255, "StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50), - "FontName"=>$font,"FontSize"=>$font_size / 1.8); + "FontName"=>$font,"FontSize"=>$font_size); $SplitChart->drawRadar($myPicture,$MyData,$Options); break; case "polar": $Options = array("Layout"=>RADAR_LAYOUT_CIRCLE,"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50), - "FontName"=>$font,"FontSize"=>$font_size / 1.8); + "FontName"=>$font,"FontSize"=>$font_size); $SplitChart->drawRadar($myPicture,$MyData,$Options); break; } @@ -796,14 +796,14 @@ function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font /* Write the picture title */ $myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size)); - $myPicture->drawText(60,35,$title,array("FontSize"=>($font_size * 1.8),"Align"=>TEXT_ALIGN_BOTTOMLEFT)); + $myPicture->drawText(60,35,$title,array("FontSize"=>$font_size,"Align"=>TEXT_ALIGN_BOTTOMLEFT)); /* Do some cosmetic and draw the chart */ $myPicture->setGraphArea(60,40,670,190); $myPicture->drawFilledRectangle(60,40,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10)); $myPicture->drawScale(array("GridR"=>180,"GridG"=>180,"GridB"=>180, "Mode" => SCALE_MODE_START0)); $myPicture->setShadow(TRUE,array("X"=>2,"Y"=>2,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); - $myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>($font_size / 1.8))); + $myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size)); $settings = array("Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE); $myPicture->drawSplineChart($settings); $myPicture->setShadow(FALSE);