From 6eb156ae5449ed83e040998011eba8570e4061c2 Mon Sep 17 00:00:00 2001 From: vgilc Date: Mon, 27 Jun 2011 16:28:10 +0000 Subject: [PATCH] 2011-06-27 Vanessa Gil * include/functions_graph.php: Display units in the legend of module graph. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4489 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 4 ++++ pandora_console/include/functions_graph.php | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 5fa724216b..f61ec1e197 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,7 @@ +2011-06-27 Vanessa Gil + + * include/functions_graph.php: Display units in the legend of module graph. + 2011-06-27 Sancho Lerena * include/functions_config.php: Added a new function to do global diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index e032b2867c..8373464a42 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -228,7 +228,7 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, $chart[$timestamp]['max'] = $previous_data; } } - + //$chart[$timestamp]['count'] = 0; ///////// //$chart[$timestamp]['timestamp_bottom'] = $timestamp; @@ -243,7 +243,9 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, $chart[$timestamp]['baseline'] = array_shift ($baseline_data); if ($chart[$timestamp]['baseline'] == NULL) { $chart[$timestamp]['baseline'] = 0; - } + } + $units = modules_get_unit($agent_module_id); + $chart[$timestamp]['unit'] = 0; } // Return chart data and don't draw @@ -270,7 +272,7 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, // Only show caption if graph is not small if ($width > MIN_WIDTH_CAPTION && $height > MIN_HEIGHT) //Flash chart - $caption = __('Max. Value') . ': ' . $max_value . ' ' . __('Avg. Value') . ': ' . $avg_value . ' ' . __('Min. Value') . ': ' . $min_value; + $caption = __('Max. Value') . ': ' . $max_value . ' ' . __('Avg. Value') . ': ' . $avg_value . ' ' . __('Min. Value') . ': ' . $min_value . ' ' . __('Units. Value') . ': ' . $units; else $caption = array(); @@ -286,6 +288,7 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, $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); + $color['unit'] = array('border' => null, 'color' => '#0097BC', 'alpha' => 10); $legend = array(); $legend['sum'] = __('Avg') . ' (' . $avg_value . ')'; @@ -298,6 +301,7 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events, $legend['max'] = __('Max') . ' (' .format_for_graph($max_value) . ')'; $legend['min'] = __('Min') . ' (' . format_for_graph($min_value) . ')'; $legend['baseline'] = __('Baseline'); + $legend['unit'] = __('Units'). ' (' . $units . ')'; $flash_chart = $config['flash_charts']; if ($only_image) { @@ -587,8 +591,9 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width, $min = format_for_graph($min); $max = format_for_graph($max); $avg = format_for_graph($avg); + $units = modules_get_unit($agent_module_id); - $module_name_list[$i] .= " (".__("Max"). ":$max, ".__("Min"). ":$min, ". __("Avg"). ": $avg)"; + $module_name_list[$i] .= " (".__("Max"). ":$max, ".__("Min"). ":$min, ". __("Avg"). ": $avg, ". __("Units"). ": $units)"; if ($weight_list[$i] != 1) { //$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")"; @@ -1985,6 +1990,7 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events, $min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2); $max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2); $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); + $unit = modules_get_unit($agent_module_id); // Fix event and alert scale $event_max = $max_value * 1.25;