diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 1019c0d178..5bd9889855 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -2926,8 +2926,6 @@ function chooseType() { $("#row_agent").show(); $("#row_module").show(); $("#row_period").show(); - $("#row_show_in_landscape").show(); - $("#row_time_compare_overlapped").show(); $("#row_historical_db_check").hide(); break; @@ -2937,8 +2935,6 @@ function chooseType() { $("#row_module").show(); $("#row_period1").show(); $("#row_estimate").show(); - $("#row_show_in_two_columns").show(); - $("#row_show_in_landscape").show(); $("#row_historical_db_check").hide(); break; @@ -2957,8 +2953,6 @@ function chooseType() { $("#row_description").show(); $("#row_period").show(); $("#row_custom_graph").show(); - $("#row_show_in_two_columns").show(); - $("#row_show_in_landscape").show(); $("#row_historical_db_check").hide(); break; @@ -3116,9 +3110,7 @@ function chooseType() { $("#row_description").show(); $("#row_query").show(); $("#row_max_items").show(); - $("#row_show_in_two_columns").show(); $("#row_dyn_height").show(); - $("#row_show_in_landscape").show(); $("#row_servers").show(); $("#row_historical_db_check").show(); break; diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 95eae04ca1..5973e80047 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -3053,10 +3053,20 @@ function series_type_graph_array($data, $show_elements_graph){ if($show_elements_graph['id_widget_dashboard']){ $opcion = unserialize(db_get_value_filter('options','twidget_dashboard',array('id' => $show_elements_graph['id_widget_dashboard']))); - foreach ($opcion as $key => $value) { + if($show_elements_graph['graph_combined']){ + + foreach ($show_elements_graph['modules_id'] as $key => $value) { + $color_series[$key] = array( + 'border' => '#000000', + 'color' => $opcion[$value], + 'alpha' => CHART_DEFAULT_ALPHA + ); + } + } + else{ $color_series[0] = array( 'border' => '#000000', - 'color' => $opcion['avg'], + 'color' => $opcion['max'], 'alpha' => CHART_DEFAULT_ALPHA ); } diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index ccb715c59b..9d7290595f 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -43,7 +43,7 @@ function config_create_value ($token, $value) { */ function config_update_value ($token, $value) { global $config; - + $config['flash_charts'] = true; // Include functions_io to can call __() function include_once($config['homedir'] . '/include/functions_io.php'); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 86570b3607..81db07101a 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -701,7 +701,8 @@ function grafico_modulo_sparse_data( 'show_overview' => true, 'return_img_base_64' => false, 'image_treshold' => false, - 'graph_combined' => false + 'graph_combined' => false, + 'zoom' => 1 ); */ function grafico_modulo_sparse ($params) { @@ -873,7 +874,7 @@ function grafico_modulo_sparse ($params) { $params['grid_color'] = '#C1C1C1'; $params['legend_color'] = '#636363'; $params['font'] = $config['fontpath']; - $params['font-size'] = $config['font_size']; + $params['font_size'] = $config['font_size']; $params['short_data'] = $config['short_module_graph_data']; if($params['only_image']){ @@ -1084,22 +1085,6 @@ function grafico_modulo_sparse ($params) { return $return; } -function graph_get_formatted_date($timestamp, $format1, $format2) { - global $config; - - if ($config['flash_charts']) { - $date = date("$format1 $format2", $timestamp); - } - else { - $date = date($format1, $timestamp); - if ($format2 != '') { - $date .= "\n".date($format2, $timestamp); - } - } - - return $date; -} - /** * Produces a combined/user defined graph * @@ -1168,6 +1153,8 @@ function graphic_combined_module ( $params_combined ) { + global $config; + if(!isset($params_combined['from_interface'])){ $params_combined['from_interface'] = false; } @@ -1182,11 +1169,11 @@ function graphic_combined_module ( } } else { - if ($id_graph == 0) { + if ($params_combined['id_graph'] == 0) { $params_combined['stacked'] = CUSTOM_GRAPH_AREA; } else { - $params_combined['stacked'] = db_get_row('tgraph', 'id_graph', $id_graph); + $params_combined['stacked'] = db_get_row('tgraph', 'id_graph', $params_combined['id_graph']); } } } @@ -1334,6 +1321,7 @@ function graphic_combined_module ( } $params['graph_combined'] = true; + $params_combined['graph_combined'] = true; if($params['only_image']){ return generator_chart_to_pdf('combined', $params, $params_combined, $module_list); @@ -1348,13 +1336,15 @@ function graphic_combined_module ( $params['grid_color'] = '#C1C1C1'; $params['legend_color'] = '#636363'; $params['font'] = $config['fontpath']; - $params['font-size'] = $config['font_size']; + $params['font_size'] = $config['font_size']; + $params['short_data'] = $config['short_module_graph_data']; global $config; global $graphic_type; $sources = false; + if ($params_combined['id_graph'] == 0) { $count_modules = count($module_list); @@ -1402,6 +1392,13 @@ function graphic_combined_module ( } } + if($module_list){ + $params_combined['modules_id'] = $module_list; + } + else{ + $params_combined['modules_id'] = $modules; + } + if(isset($summatory)){ $params_combined['summatory'] = $summatory; } @@ -1543,6 +1540,8 @@ function graphic_combined_module ( } if($params_combined['projection'] && is_array($params_combined['projection'])){ + $date_array_projection = max($params_combined['projection']); + $date_array['final_date'] = $date_array_projection[0] / 1000; $array_data['projection']['data']= $params_combined['projection']; } @@ -2252,7 +2251,7 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return = 'backgroundColor' => '#f9faf9', 'type_graph' => 'area', 'font' => $config['fontpath'], - 'font-size' => $config['font_size'], + 'font_size' => $config['font_size'], 'array_data_create' => $data_array, 'show_overview' => false, 'show_export_csv' => false, @@ -4123,7 +4122,7 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $unit = 'backgroundColor' => 'white', 'type_graph' => 'area', 'font' => $config['fontpath'], - 'font-size' => $config['font_size'], + 'font_size' => $config['font_size'], 'array_data_create' => $chart ); @@ -4184,7 +4183,7 @@ function graph_netflow_total_area ($data, $period, $width, $height, $unit = '', 'backgroundColor' => 'white', 'type_graph' => 'area', 'font' => $config['fontpath'], - 'font-size' => $config['font_size'], + 'font_size' => $config['font_size'], 'array_data_create' => $chart ); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 5cfca22016..7ec036ffb5 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -6295,77 +6295,12 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', $report, $content); - $graphs = db_get_all_rows_field_filter ("tgraph_source", - "id_graph", $content['id_gs']); - $modules = array (); - $weights = array (); - if ($graphs === false) - $graphs = array(); - - $labels = array(); - foreach ($graphs as $graph_item) { - if ($type_report == 'automatic_graph') { - array_push ($modules, array( - 'module' => $graph_item['id_agent_module'], - 'server' => $graph_item['id_server'])); - } - else { - array_push ($modules, $graph_item['id_agent_module']); - } - - if (in_array('label',$content['style'])) { - if (defined('METACONSOLE')) { - $server_name = $content['server_name']; - $connection = metaconsole_get_connection($server_name); - if (!metaconsole_load_external_db($connection)) { - //ui_print_error_message ("Error connecting to ".$server_name); - continue; - } - $item = array('type' => 'custom_graph', - 'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']), - 'id_agent_module'=>$graph_item['id_agent_module']); - } - else { - $item = array('type' => 'custom_graph', - 'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']), - 'id_agent_module'=>$graph_item['id_agent_module']); - } - - $label = reporting_label_macro($item, $content['style']['label']); - - $labels[$graph_item['id_agent_module']] = $label; - if (defined('METACONSOLE')) { - //Restore db connection - metaconsole_restore_db(); - } - } - - array_push ($weights, $graph_item["weight"]); - } - - if ($config['metaconsole'] && $type_report != 'automatic_graph') { - $id_meta = metaconsole_get_id_server($content["server_name"]); - $server = metaconsole_get_connection_by_id ($id_meta); - metaconsole_connect($server); - } + $graphs = db_get_all_rows_field_filter ("tgraph", "id_graph", $content['id_gs']); $return['chart'] = ''; - // Get chart - //reporting_set_conf_charts($width, $height, $only_image, $type, - // $content, $ttl); -$width =null; -$height =null; - //height for bullet chart - /* - if($graph['stacked'] != 4){ - $height += count($modules) * REPORTING_CUSTOM_GRAPH_LEGEND_EACH_MODULE_VERTICAL_SIZE; - } - else{ - if(!$only_image){ - $height = 50; - } - } -*/ + + $width =null; + $height =null; switch ($type) { case 'dinamic': @@ -6379,17 +6314,16 @@ $height =null; 'only_image' => $pdf, 'homeurl' => ui_get_full_url(false, false, false, false), 'ttl' => $ttl, - 'percentil' => $graph["percentil"], - 'fullscale' => $graph["fullscale"], + 'percentil' => $graphs[0]["percentil"], + 'fullscale' => $graphs[0]["fullscale"], ); $params_combined = array( - 'weight_list' => $weights, - 'stacked' => $graph["stacked"], - 'labels' => $labels, - 'summatory' => $graph["summatory_series"], - 'average' => $graph["average_series"], - 'modules_series' => $graph["modules_series"] + 'stacked' => $graphs[0]["stacked"], + 'summatory' => $graphs[0]["summatory_series"], + 'average' => $graphs[0]["average_series"], + 'modules_series' => $graphs[0]["modules_series"], + 'id_graph' => $content['id_gs'] ); $return['chart'] = graphic_combined_module( diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 722d1dbf6b..2e29d6bb57 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -874,7 +874,7 @@ function pandoraFlotArea( graph_id, values, legend, var menu = params.menu; var min_x = date_array['start_date'] *1000; var max_x = date_array['final_date'] *1000; - var type = params.stacked; + var type = parseInt(params.stacked); var show_legend = params.show_legend; var image_treshold = params.image_treshold; var short_data = params.short_data; @@ -884,7 +884,7 @@ function pandoraFlotArea( graph_id, values, legend, //XXXXXX colocar var force_integer = 0; - +console.log(type); if(typeof type === 'undefined' || type == ''){ type = params.type_graph; } @@ -1475,7 +1475,7 @@ function pandoraFlotArea( graph_id, values, legend, } } } - +console.log(type); switch (type) { case 'line': case 2: @@ -1593,7 +1593,7 @@ function pandoraFlotArea( graph_id, values, legend, } var maxticks = date_array['period'] / 3600 / number_ticks; -console.log(grid_color); + var options = { series: { stack: stacked, @@ -1628,7 +1628,7 @@ console.log(grid_color); xaxes: [{ axisLabelUseCanvas: true, axisLabelFontSizePixels: font_size, - axisLabelFontFamily: font+'Font', + axisLabelFontFamily: font, axisLabelPadding: 0, mode: "time", timezone: "browser", @@ -1730,7 +1730,7 @@ if (vconsole) { xaxes: [{ axisLabelUseCanvas: true, axisLabelFontSizePixels: font_size, - axisLabelFontFamily: font+'Font', + axisLabelFontFamily: font, axisLabelPadding: 0, mode: "time", timezone: "browser", @@ -1755,8 +1755,6 @@ if (vconsole) { }); } - $('#legend_' + graph_id + ' .legendLabel').css('color', legend_color); - // Adjust overview when main chart is resized $('#overview_'+graph_id).resize(function(){ update_left_width_canvas(graph_id); @@ -1805,7 +1803,7 @@ if (vconsole) { xaxes: [{ axisLabelUseCanvas: true, axisLabelFontSizePixels: font_size, - axisLabelFontFamily: font+'Font', + axisLabelFontFamily: font, axisLabelPadding: 0, mode: "time", timezone: "browser", @@ -1846,7 +1844,7 @@ if (vconsole) { xaxes: [{ axisLabelUseCanvas: true, axisLabelFontSizePixels: font_size, - axisLabelFontFamily: font+'Font', + axisLabelFontFamily: font, axisLabelPadding: 0, mode: "time", timezone: "browser", @@ -2163,6 +2161,7 @@ if (vconsole) { $('#legend_' + graph_id + ' .legendLabel') .eq(i).html(label_aux); } + $('#legend_' + graph_id + ' .legendLabel').css('color', legend_color); plot.clearCrosshair(); if(!vconsole){ overview.clearCrosshair(); @@ -2211,7 +2210,7 @@ if (vconsole) { } function lFormatter(v, item) { - return '