diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index af41801336..361975b29c 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -251,7 +251,7 @@ function custom_graphs_print($id_graph, $height, $width, $period, false, $background_color, $name_list, - $unit_list, + array(), $show_last, $show_max, $show_min, diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 01b8407aa0..5fb4aceda9 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -929,13 +929,13 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, line_graph($flash_chart, $chart, $width, $height/2, $color, $legend, $long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", $unit, $water_mark, $config['fontpath'], + $title, $unit, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, $homeurl, $backgroundColor). '
'. line_graph($flash_chart, $chart_prev, $width, $height/2, $color, $legend, $long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", $unit, $water_mark, $config['fontpath'], + $title, $unit, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, $homeurl, $backgroundColor); } else { @@ -944,7 +944,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, line_graph($flash_chart, $chart, $width, $height, $color, $legend, $long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", $unit, $water_mark, $config['fontpath'], + $title, $unit, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, $homeurl, $backgroundColor); } } @@ -1436,9 +1436,6 @@ function graphic_combined_module ($module_list, $weight_list, $period, if (!empty($unit_list) && $units_number == $module_number && isset($unit_list[$i])) { $unit = $unit_list[$i]; } - else { - $unit = modules_get_unit($agent_module_id); - } if ($projection == false or ($projection != false and $i == 0)) { $module_name_list[$i] .= ": "; @@ -1778,22 +1775,12 @@ function graphic_combined_module ($module_list, $weight_list, $period, $graph_values = $temp; - /* - for ($i = 0; $i < $module_number; $i++) { - if ($weight_list[$i] != 1) { - $module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")"; - } - } - */ - 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)); } - - //Work around for fixed the agents name with huge size chars. $fixed_font_size = $config['font_size']; @@ -4130,7 +4117,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, line_graph($flash_chart, $chart, $width, $height, $color, $legend, $long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", $unit, $water_mark, $config['fontpath'], + $title, $unit, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, $homeurl, $backgroundColor); } } @@ -4713,7 +4700,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, if ($type_graph === 'area') { return area_graph($flash_chart, $chart, $width, $height, $color, - $legend, array(), '', "", $unit, $homeurl, + $legend, array(), '', $title, $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, 1, array(), array(), 0, 0, $adapt_key, true, '', $menu); } @@ -4722,7 +4709,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, line_graph($flash_chart, $chart, $width, $height, $color, $legend, $long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false), - "", $unit, $water_mark, $config['fontpath'], + $title, $unit, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, $homeurl, $backgroundColor); } } diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 91bf033208..2fcd7254a4 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -974,24 +974,24 @@ function visual_map_print_item($mode = "read", $layoutData, if ($layoutData['label_position']=='left') { $img = '
'. grafico_modulo_sparse($id_module, $period, - 0, 300, 180, '',null, false, 1, false, 0, - '', 0, 0, true, $only_image, '', 1, false, '', + 0, 300, 180, modules_get_agentmodule_name($id_module),null, false, 1, false, 0, + modules_get_unit($id_module), 0, 0, true, $only_image, '', 1, false, '', false, false, false, $layoutData['image'], null, true, false, $type_graph) . '
'; } elseif($layoutData['label_position']=='right') { $img = '
' . grafico_modulo_sparse($id_module, - $period, 0, 300, 180, '',null, false, - 1, false, 0, '', 0, 0, true, $only_image, '', + $period, 0, 300, 180, modules_get_agentmodule_name($id_module),null, false, + 1, false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '', 1, false, '', false, false, false, $layoutData['image'], null, true, false, $type_graph) . '
'; } else { $img = grafico_modulo_sparse($id_module, - $period, 0, 300, 180, '',null, false, 1, - false, 0, '', 0, 0, true, $only_image, '', + $period, 0, 300, 180, modules_get_agentmodule_name($id_module),null, false, 1, + false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '', 1, false, '', false, false, false, $layoutData['image'], null, true, false, $type_graph); } @@ -1000,8 +1000,8 @@ function visual_map_print_item($mode = "read", $layoutData, if ($layoutData['label_position']=='left') { $img = '
' . grafico_modulo_sparse($id_module, $period, - 0, $width, $height, '', null, false, 1, - false, 0, '', 0, 0, true, $only_image, '', + 0, $width, $height, modules_get_agentmodule_name($id_module), null, false, 1, + false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '', 1, false, '', false, false, false, $layoutData['image'], null, true, false, $type_graph) . '
'; @@ -1009,16 +1009,16 @@ function visual_map_print_item($mode = "read", $layoutData, elseif ($layoutData['label_position']=='right') { $img = '
' . grafico_modulo_sparse($id_module, $period, - 0, $width, $height, '', null, false, 1, - false, 0, '', 0, 0, true, $only_image, - '', 1, false, '', false, false, false, + 0, $width, $height, modules_get_agentmodule_name($id_module), null, false, 1, + false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, + '', 1, false, modules_get_unit($id_module), false, false, false, $layoutData['image'], null, true, false, $type_graph) . '
'; } else { $img = grafico_modulo_sparse($id_module, - $period, 0, $width, $height, '', null, - false, 1, false, 0, '', 0, 0, true, + $period, 0, $width, $height, modules_get_agentmodule_name($id_module), null, + false, 1, false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '', 1, false, '', false, false, false, $layoutData['image'], null, false, true, $type_graph); diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 7e8b6074c2..6787e8b31c 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -564,7 +564,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $vconsole, false, $percentil_values, - $threshold_data); + $threshold_data, + $xaxisname); } else { $graph = array(); diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index d21e6ceada..d4f21f65b3 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -1392,7 +1392,10 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, // minTickSize var count_data = datas[0].data.length; var min_tick_pixels = 80; - //~ var steps = parseInt( count_data / (width/min_tick_pixels)); + + if (unit != "") { + xaxisname = xaxisname + " (" + unit + ")" + } var options = { series: { @@ -1428,6 +1431,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, tickFormatter: yFormatter, color: '', alignTicksWithAxis: 1, + labelWidth: 30, position: 'left', font: font, reserveSpace: true, @@ -1763,7 +1767,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, function yFormatter(v, axis) { axis.datamin = 0; - var formatted = number_format(v,force_integer,unit); + var formatted = number_format(v, force_integer, ""); return '
'+formatted+'
'; } @@ -1917,7 +1921,7 @@ function adjust_menu(graph_id, plot, parent_height, width) { } offset = $('#' + graph_id)[0].offsetTop; - console.log(offset); + $('#menu_' + graph_id).css('top', ((offset) + 'px')); //$('#legend_' + graph_id).css('width',plot.width()); @@ -1986,6 +1990,7 @@ function get_event_details (event_ids) { function adjust_left_width_canvas(adapter_id, adapted_id) { var adapter_left_margin = $('#'+adapter_id+' .yAxis .tickLabel').width(); var adapted_pix = $('#'+adapted_id).width(); + var new_adapted_width = adapted_pix - adapter_left_margin; $('#'+adapted_id).width(new_adapted_width); diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index a8b7f250ab..fe8ceea41d 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -138,7 +138,8 @@ function flot_line_stacked_graph($chart_data, $width, $height, $color, $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '', $menu = true, $background_color = 'white', - $dashboard = false, $vconsole = false, $agent_module_id = 0) { + $dashboard = false, $vconsole = false, $agent_module_id = 0, + $xaxisname = "") { global $config; @@ -147,7 +148,7 @@ function flot_line_stacked_graph($chart_data, $width, $height, $color, $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str, $menu, $background_color, $dashboard, $vconsole, - $agent_module_id, $font, $font_size); + $agent_module_id, $font, $font_size, $xaxisname); } function flot_line_simple_graph($chart_data, $width, $height, $color, @@ -157,7 +158,8 @@ function flot_line_simple_graph($chart_data, $width, $height, $color, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '', $menu = true, $background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0, - $percentil_values = array(), $threshold_data = array()) { + $percentil_values = array(), $threshold_data = array(), + $xaxisname = '') { global $config; @@ -166,7 +168,7 @@ function flot_line_simple_graph($chart_data, $width, $height, $color, $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str, $menu, $background_color, $dashboard, $vconsole, - $agent_module_id, $font, $font_size, '', $percentil_values, + $agent_module_id, $font, $font_size, $xaxisname, $percentil_values, $threshold_data); } @@ -180,7 +182,6 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, global $config; - include_javascript_dependencies_flot_graph(); $menu = (int)$menu; diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 68c1958c45..bff1b328b0 100644 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -141,16 +141,6 @@ if (isset($graph['percentil'])){ $percentil = $graph['percentil']; } - - -/* -$colors = array(); -$colors['pep1'] = array('border' => '#000000', 'color' => '#000000', 'alpha' => 50); -$colors['pep2'] = array('border' => '#ff7f00', 'color' => '#ff0000', 'alpha' => 50); -$colors['pep3'] = array('border' => '#ff0000', 'color' => '#00ff00', 'alpha' => 50); -$colors['pep4'] = array('border' => '#000000', 'color' => '#0000ff', 'alpha' => 50); -*/ - $step = 1; if ($force_steps) { $pixels_between_xdata = 50; @@ -357,26 +347,6 @@ if($countlegend > 15){ } } -/*foreach($colors as $i => $color) { - if (isset($color['border'])) { - $rgb['border'] = html_html2rgb($color['border']); - $rgb_color[$i]['border']['R'] = $rgb['border'][0]; - $rgb_color[$i]['border']['G'] = $rgb['border'][1]; - $rgb_color[$i]['border']['B'] = $rgb['border'][2]; - } - - if (isset($color['color'])) { - $rgb['color'] = html_html2rgb($color['color']); - $rgb_color[$i]['color']['R'] = $rgb['color'][0]; - $rgb_color[$i]['color']['G'] = $rgb['color'][1]; - $rgb_color[$i]['color']['B'] = $rgb['color'][2]; - } - - if (isset($color['color'])) { - $rgb_color[$i]['alpha'] = $color['alpha']; - } -}*/ - ob_get_clean(); //HACK TO EAT ANYTHING THAT CORRUPS THE IMAGE FILE switch ($graph_type) { @@ -807,10 +777,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, if (!is_array($legend) || empty($legend)) { unset($legend); } - /*$legend=array('pep1' => 'pep1','pep2' => 'pep2','pep3' => 'pep3','pep4' => 'pep4'); - $data=array(array('pep1' => 1, 'pep2' => 1, 'pep3' => 3, 'pep4' => 3), array('pep1' => 1, 'pep2' => 3, 'pep3' => 1,'pep4' => 4), array('pep1' => 3, 'pep2' => 1, 'pep3' => 1,'pep4' =>1), array('pep1' => 1, 'pep2' =>1, 'pep3' =>1,'pep4' =>0)); - $index=array(1,2,3,4); - */ + if (is_array(reset($data))) { $data2 = array(); foreach ($data as $i =>$values) { @@ -882,7 +849,6 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $MyData->setSerieWeight($point_id, $config['custom_graph_width'] * $reduction_coefficient); } - //$MyData->addPoints($data,"Yaxis"); $MyData->setAxisName(0,$unit); $MyData->addPoints($index,"Xaxis"); $MyData->setSerieDescription("Xaxis", $xaxisname);