diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php index e6e0bcb862..d50a5d8b55 100644 --- a/pandora_console/godmode/reporting/graph_builder.main.php +++ b/pandora_console/godmode/reporting/graph_builder.main.php @@ -1,29 +1,44 @@ "; - +$url = 'index.php?sec=reporting&sec2=godmode/reporting/graph_builder'; if ($edit_graph) { - echo "
"; + $output = ""; } else { - echo ""; + $output = ""; } -echo ''; -echo "".__('Name').''; -echo "'; +$output .= "'; +$output .= '>'; $own_info = get_user_info($config['id_user']); -echo ''.__('Group').''; +$output .= ''.__('Group').''; if (check_acl($config['id_user'], 0, 'RW')) { - echo html_print_select_groups($config['id_user'], 'RW', true, 'graph_id_group', $id_group, '', '', '', true); + $output .= html_print_select_groups( + $config['id_user'], + 'RW', + true, + 'graph_id_group', + $id_group, + '', + '', + '', + true + ); } else if (check_acl($config['id_user'], 0, 'RM')) { - echo html_print_select_groups($config['id_user'], 'RM', true, 'graph_id_group', $id_group, '', '', '', true); + $output .= html_print_select_groups( + $config['id_user'], + 'RM', + true, + 'graph_id_group', + $id_group, + '', + '', + '', + true + ); } -echo ''; -echo ''; -echo "".__('Description').''; -echo "'; -echo ''; +$output .= ''; +$output .= ''; if ($stacked == CUSTOM_GRAPH_GAUGE) { $hidden = ' style="display:none;" '; } else { $hidden = ''; } -echo ''; -echo ""; -echo ''.__('Period').''; -echo ""; -html_print_extended_select_for_time('period', $period, '', '', '0', 10); -echo ""; -echo ''.__('Type of graph').''; -echo "
"; +$output .= ''; +$output .= ""; +$output .= ''.__('Period').''; +$output .= ""; +$output .= html_print_extended_select_for_time( + 'period', + $period, + '', + '', + '0', + 10, + true +); +$output .= ""; +$output .= ''.__('Type of graph').''; +$output .= "
"; require_once $config['homedir'].'/include/functions_graph.php'; @@ -158,85 +205,149 @@ $stackeds = [ CUSTOM_GRAPH_VBARS => __('Vertical bars'), CUSTOM_GRAPH_PIE => __('Pie'), ]; -html_print_select($stackeds, 'stacked', $stacked); +$output .= html_print_select($stackeds, 'stacked', $stacked, '', '', 0, true); -echo '
'; +$output .= '
'; -echo "".__('Percentil').''; -echo "".html_print_checkbox('percentil', 1, $percentil, true).''; -echo "".__('Equalize maximum thresholds').''; -echo "".html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, true, false, '', false); -echo ''; -echo "".__('Add summatory series').''; -echo "".html_print_checkbox('summatory_series', 1, $summatory_series, true)." -".__('Add average series').''; -echo "".html_print_checkbox('average_series', 1, $average_series, true).''; -echo "".__('Modules and series').''; +$output .= ''; +$output .= ""; +$output .= __('Equalize maximum thresholds'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox( + 'threshold', + CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, + $check, + true, + false, + '', + false +); +$output .= ''; -echo "".html_print_checkbox('modules_series', 1, $modules_series, true).''; -echo "".__('Show full scale graph (TIP)').''; -echo "".html_print_checkbox('fullscale', 1, $fullscale, true).''; -echo ''; -echo ''; +$output .= ""; +$output .= __('Percentil'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox( + 'percentil', + 1, + $percentil, + true +); +$output .= ''; +$output .= ''; + +$output .= ""; +$output .= __('Add summatory series'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox( + 'summatory_series', + 1, + $summatory_series, + true +); +$output .= ""; +$output .= __('Add average series'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox( + 'average_series', + 1, + $average_series, + true +); +$output .= ''; +$output .= ""; +$output .= __('Modules and series'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox('modules_series', 1, $modules_series, true); +$output .= ''; +$output .= ""; +$output .= __('Show full scale graph (TIP)'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox('fullscale', 1, $fullscale, true); +$output .= ''; +$output .= ''; + +$output .= ''; if ($edit_graph) { - echo "
"; + $output .= "
"; + $output .= ""; + $output .= '
'; } else { - echo "
"; + $output .= "
"; + $output .= ""; + $output .= '
'; } -echo ''; +$output .= ''; +echo $output; +?> +'; + $("#checkbox-summatory_series").change(function() { + if( $("#checkbox-summatory_series").is(":checked") && + $("#checkbox-modules_series").is(":disabled") + ) { + $("#checkbox-modules_series").removeAttr("disabled"); + } else if(!$("#checkbox-average_series").is(":checked")) { + $("#checkbox-modules_series").attr("disabled", true); + $("#checkbox-modules_series").attr("checked", false); + } + }); + + $("#checkbox-average_series").change(function() { + if( $("#checkbox-average_series").is(":checked") && + $("#checkbox-modules_series").is(":disabled") + ) { + $("#checkbox-modules_series").removeAttr("disabled"); + } else if(!$("#checkbox-summatory_series").is(":checked")) { + $("#checkbox-modules_series").attr("disabled", true); + $("#checkbox-modules_series").attr("checked", false); + } + }); + }); + diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 23aa4b0771..f0262f6e5f 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -1,16 +1,31 @@ $config['id_user'], 'name' => $name, @@ -114,7 +131,7 @@ if ($add_graph) { if (trim($name) != '') { $id_graph = db_process_sql_insert('tgraph', $values); if ($id_graph !== false) { - db_pandora_audit('Report management', "Create graph #$id_graph"); + db_pandora_audit('Report management', 'Create graph #'.$id_graph); } else { db_pandora_audit('Report management', 'Fail try to create graph'); } @@ -166,9 +183,15 @@ if ($update_graph) { ['id_graph' => $id_graph] ); if ($success !== false) { - db_pandora_audit('Report management', "Update graph #$id_graph"); + db_pandora_audit( + 'Report management', + 'Update graph #'.$id_graph + ); } else { - db_pandora_audit('Report management', "Fail try to update graph #$id_graph"); + db_pandora_audit( + 'Report management', + 'Fail try to update graph #'.$id_graph + ); } } else { $success = false; @@ -188,12 +211,12 @@ if ($add_module) { $id_agents = get_parameter('id_agents'); $weight = get_parameter('weight'); - // Id modules has double entities conversion - // Safe output remove all entities + // Id modules has double entities conversion. + // Safe output remove all entities. io_safe_output_array($id_modules, ''); // We need to put the entities again - // to browse in db + // to browse in db. io_safe_input_array($id_modules); $id_agent_modules = db_get_all_rows_sql( @@ -304,23 +327,39 @@ switch ($tab) { } if ($add_graph) { - ui_print_result_message($id_graph, __('Graph stored successfully'), __('There was a problem storing Graph')); + ui_print_result_message( + $id_graph, + __('Graph stored successfully'), + __('There was a problem storing Graph') + ); } if ($add_module) { - ui_print_result_message($result, __('Module added successfully'), __('There was a problem adding Module')); + ui_print_result_message( + $result, + __('Module added successfully'), + __('There was a problem adding Module') + ); } if ($update_graph) { - ui_print_result_message($success, __('Update the graph'), __('Bad update the graph')); + ui_print_result_message( + $success, + __('Update the graph'), + __('Bad update the graph') + ); } if ($delete_module) { - ui_print_result_message($result, __('Graph deleted successfully'), __('There was a problem deleting Graph')); + ui_print_result_message( + $result, + __('Graph deleted successfully'), + __('There was a problem deleting Graph') + ); } -// Parse CHUNK information into showable information -// Split id to get all parameters +// Parse CHUNK information into showable information. +// Split id to get all parameters. if (!$delete_module) { if (isset($_POST['period'])) { $period = $_POST['period']; diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index e21c3b6e55..8c07381452 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -917,6 +917,15 @@ $row++; ); $row++; + $table_chars->data[$row][0] = __('Chart fit to content'); + $table_chars->data[$row][1] = html_print_checkbox_switch( + 'maximum_y_axis', + 1, + $config['maximum_y_axis'], + true + ); + $row++; + $table_chars->data[$row][0] = __('Type of module charts'); $table_chars->data[$row][1] = __('Area').' '.html_print_radio_button( 'type_module_charts', diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 3922e0ddf4..ea94b3a7da 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -925,6 +925,10 @@ function config_update_config() $error_update[] = __('Use round corners'); } + if (!config_update_value('maximum_y_axis', (bool) get_parameter('maximum_y_axis'))) { + $error_update[] = __('Chart fit to content'); + } + if (!config_update_value('show_qr_code_header', (bool) get_parameter('show_qr_code_header'))) { $error_update[] = __('Show QR code header'); } @@ -1772,6 +1776,10 @@ function config_process_config() config_update_value('round_corner', false); } + if (isset($config['maximum_y_axis']) === false) { + config_update_value('maximum_y_axis', false); + } + if (!isset($config['show_qr_code_header'])) { config_update_value('show_qr_code_header', false); } diff --git a/pandora_console/include/functions_forecast.php b/pandora_console/include/functions_forecast.php index a7e5545d55..212098e23f 100644 --- a/pandora_console/include/functions_forecast.php +++ b/pandora_console/include/functions_forecast.php @@ -56,7 +56,17 @@ function forecast_projection_graph( 'projection' => true, ]; - $module_data = grafico_modulo_sparse($params, $server_name); + if (is_metaconsole()) { + $id_meta = metaconsole_get_id_server($server_name); + $server = metaconsole_get_connection_by_id($id_meta); + metaconsole_connect($server); + } + + $module_data = grafico_modulo_sparse($params); + + if (is_metaconsole()) { + metaconsole_restore_db(); + } if (empty($module_data)) { return []; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 9747cb1033..b4505df1a0 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -629,172 +629,177 @@ function grafico_modulo_sparse_data( * 'graph_render' => 0, * 'zoom' => 1, * 'server_id' => null, - * 'stacked' => 0. + * 'stacked' => 0 + * 'maximum_y_axis' => 0. * * @return string html Content graphs. */ -function grafico_modulo_sparse($params, $server_name='') +function grafico_modulo_sparse($params) { global $config; - if (!isset($params) || !is_array($params)) { + if (isset($params) === false || is_array($params) === false) { return false; } - if (!isset($params['period'])) { + if (isset($params['period']) === false) { return false; } - if (!isset($params['show_events'])) { + if (isset($params['show_events']) === false) { $params['show_events'] = false; } - if (!isset($params['width'])) { + if (isset($params['width']) === false) { $params['width'] = '90%'; } - if (!isset($params['height'])) { + if (isset($params['height']) === false) { $params['height'] = 450; } - if (!isset($params['title'])) { + if (isset($params['title']) === false) { $params['title'] = ''; } - if (!isset($params['unit_name'])) { + if (isset($params['unit_name']) === false) { $params['unit_name'] = null; } - if (!isset($params['show_alerts'])) { + if (isset($params['show_alerts']) === false) { $params['show_alerts'] = false; } - if (!isset($params['date']) || !$params['date']) { + if (isset($params['date']) === false || !$params['date']) { $params['date'] = get_system_time(); } - if (!isset($params['unit'])) { + if (isset($params['unit']) === false) { $params['unit'] = ''; } - if (!isset($params['baseline'])) { + if (isset($params['baseline']) === false) { $params['baseline'] = 0; } - if (!isset($params['return_data'])) { + if (isset($params['return_data']) === false) { $params['return_data'] = 0; } - if (!isset($params['show_title'])) { + if (isset($params['show_title']) === false) { $show_title = true; } - if (!isset($params['only_image'])) { + if (isset($params['only_image']) === false) { $params['only_image'] = false; } - if (!isset($params['homeurl'])) { + if (isset($params['homeurl']) === false) { $params['homeurl'] = $config['homeurl']; } - if (!isset($params['ttl'])) { + if (isset($params['ttl']) === false) { $params['ttl'] = 1; } - if (!isset($params['adapt_key'])) { + if (isset($params['adapt_key']) === false) { $params['adapt_key'] = ''; } - if (!isset($params['compare'])) { + if (isset($params['compare']) === false) { $params['compare'] = false; } - if (!isset($params['show_unknown'])) { + if (isset($params['show_unknown']) === false) { $params['show_unknown'] = false; } - if (!isset($params['menu'])) { + if (isset($params['menu']) === false) { $params['menu'] = true; } - if (!isset($params['show_legend'])) { + if (isset($params['show_legend']) === false) { $params['show_legend'] = true; } - if (!isset($params['show_overview'])) { + if (isset($params['show_overview']) === false) { $params['show_overview'] = true; } - if (!isset($params['show_export_csv'])) { + if (isset($params['show_export_csv']) === false) { $params['show_export_csv'] = true; } - if (!isset($params['backgroundColor'])) { + if (isset($params['backgroundColor']) === false) { $params['backgroundColor'] = 'white'; } - if (!isset($params['percentil'])) { + if (isset($params['percentil']) === false) { $params['percentil'] = null; } - if (!isset($params['dashboard'])) { + if (isset($params['dashboard']) === false) { $params['dashboard'] = false; } - if (!isset($params['vconsole']) || $params['vconsole'] == false) { + if (isset($params['vconsole']) === false || $params['vconsole'] == false) { $params['vconsole'] = false; } else { $params['menu'] = false; } - if (!isset($params['type_graph'])) { + if (isset($params['type_graph']) === false) { $params['type_graph'] = $config['type_module_charts']; } - if (!isset($params['fullscale'])) { + if (isset($params['fullscale']) === false) { $params['fullscale'] = false; } - if (!isset($params['id_widget_dashboard'])) { + if (isset($params['id_widget_dashboard']) === false) { $params['id_widget_dashboard'] = false; } - if (!isset($params['force_interval'])) { + if (isset($params['force_interval']) === false) { $params['force_interval'] = ''; } - if (!isset($params['time_interval'])) { + if (isset($params['time_interval']) === false) { $params['time_interval'] = 300; } - if (!isset($params['array_data_create'])) { + if (isset($params['array_data_create']) === false) { $params['array_data_create'] = 0; } - if (!isset($params['return_img_base_64'])) { + if (isset($params['return_img_base_64']) === false) { $params['return_img_base_64'] = false; } - if (!isset($params['image_treshold'])) { + if (isset($params['image_treshold']) === false) { $params['image_treshold'] = false; } - if (!isset($params['graph_combined'])) { + if (isset($params['graph_combined']) === false) { $params['graph_combined'] = false; } - if (!isset($params['zoom'])) { + if (isset($params['zoom']) === false) { $params['zoom'] = ($config['zoom_graph']) ? $config['zoom_graph'] : 1; } - if (!isset($params['type_mode_graph'])) { + if (isset($params['type_mode_graph']) === false) { $params['type_mode_graph'] = $config['type_mode_graph']; if (isset($params['graph_render']) === true) { $params['type_mode_graph'] = $params['graph_render']; } } - if (!isset($params['projection'])) { + if (isset($params['maximum_y_axis']) === false) { + $params['maximum_y_axis'] = $config['maximum_y_axis']; + } + + if (isset($params['projection']) === false) { $params['projection'] = false; } @@ -802,7 +807,7 @@ function grafico_modulo_sparse($params, $server_name='') $params['pdf'] = false; } - if (!isset($params['agent_module_id'])) { + if (isset($params['agent_module_id']) === false) { return graph_nodata_image( $params['width'], $params['height'], @@ -815,14 +820,12 @@ function grafico_modulo_sparse($params, $server_name='') $agent_module_id = $params['agent_module_id']; } - if (!isset($params['stacked'])) { + if (isset($params['stacked']) === false) { $params['stacked'] = 0; } - // TODO: Configurable. $params['grid_color'] = '#C1C1C1'; $params['legend_color'] = '#636363'; - $params['font'] = $config['fontpath']; $params['font_size'] = $config['font_size']; $params['short_data'] = $config['short_module_graph_data']; @@ -880,14 +883,14 @@ function grafico_modulo_sparse($params, $server_name='') } // Format of the graph. - if (empty($params['unit'])) { + if (empty($params['unit']) === true) { $params['unit'] = $module_data['unit']; if (modules_is_unit_macro($params['unit'])) { $params['unit'] = ''; } } - if (empty($params['divisor'])) { + if (empty($params['divisor']) === true) { $params['divisor'] = get_data_multiplier($params['unit']); } @@ -986,7 +989,7 @@ function grafico_modulo_sparse($params, $server_name='') // Check available data. if ($params['compare'] === 'separated') { - if (!empty($array_data)) { + if (empty($array_data) === false) { $return = area_graph( $agent_module_id, $array_data, @@ -1011,7 +1014,7 @@ function grafico_modulo_sparse($params, $server_name='') } $return .= '
'; - if (!empty($array_data_prev)) { + if (empty($array_data_prev) === false) { $series_type_array = series_type_graph_array( $array_data_prev, $params @@ -1116,11 +1119,11 @@ function graphic_combined_module( ) { global $config; - if (!isset($params_combined['from_interface'])) { + if (isset($params_combined['from_interface']) === false) { $params_combined['from_interface'] = false; } - if (!isset($params_combined['stacked'])) { + if (isset($params_combined['stacked']) === false) { if ($params_combined['from_interface']) { if ($config['type_interface_charts'] == 'line') { $params_combined['stacked'] = CUSTOM_GRAPH_LINE; @@ -1131,155 +1134,165 @@ function graphic_combined_module( if ($params_combined['id_graph'] == 0) { $params_combined['stacked'] = CUSTOM_GRAPH_AREA; } else { - $params_combined['stacked'] = db_get_row('tgraph', 'id_graph', $params_combined['id_graph']); + $params_combined['stacked'] = db_get_row( + 'tgraph', + 'id_graph', + $params_combined['id_graph'] + ); } } } $params['stacked'] = $params_combined['stacked']; - if (!isset($params_combined['projection']) || $params_combined['projection'] == false) { + if (isset($params_combined['projection']) === false + || $params_combined['projection'] == false + ) { $params_combined['projection'] = false; } else { $params['stacked'] = 'area'; $params['projection'] = true; } - if (!isset($params_combined['labels'])) { + if (isset($params_combined['labels']) === false) { $params_combined['labels'] = []; } - if (!isset($params_combined['summatory'])) { + if (isset($params_combined['summatory']) === false) { $params_combined['summatory'] = 0; } - if (!isset($params_combined['average'])) { + if (isset($params_combined['average']) === false) { $params_combined['average'] = 0; } - if (!isset($params_combined['modules_series'])) { + if (isset($params_combined['modules_series']) === false) { $params_combined['modules_series'] = 0; } - if (!isset($params_combined['return'])) { + if (isset($params_combined['return']) === false) { $params_combined['return'] = 1; } - if (!isset($params_combined['id_graph'])) { + if (isset($params_combined['id_graph']) === false) { $params_combined['id_graph'] = 0; } - if (!isset($params_combined['type_report'])) { + if (isset($params_combined['type_report']) === false) { $params_combined['type_report'] = ''; } - if (!isset($params['percentil'])) { + if (isset($params['percentil']) === false) { $params_combined['percentil'] = null; } else { $params_combined['percentil'] = $params['percentil']; } - if (!isset($params['period'])) { + if (isset($params['period']) === false) { return false; } - if (!isset($params['width'])) { + if (isset($params['width']) === false) { $params['width'] = '90%'; } - if (!isset($params['height'])) { + if (isset($params['height']) === false) { $params['height'] = 450; } - if (!isset($params['title'])) { + if (isset($params['title']) === false) { $params['title'] = ''; } - if (!isset($params['unit_name'])) { + if (isset($params['unit_name']) === false) { $params['unit_name'] = null; } - if (!isset($params['show_alerts'])) { + if (isset($params['show_alerts']) === false) { $params['show_alerts'] = false; } - if (!isset($params['date']) || !$params['date']) { + if (isset($params['date']) === false || !$params['date']) { $params['date'] = get_system_time(); } - if (!isset($params['only_image'])) { + if (isset($params['only_image']) === false) { $params['only_image'] = false; } - if (!isset($params['ttl'])) { + if (isset($params['ttl']) === false) { $params['ttl'] = 1; } - if (!isset($params['backgroundColor'])) { + if (isset($params['backgroundColor']) === false) { $params['backgroundColor'] = 'white'; } - if (!isset($params['dashboard'])) { + if (isset($params['dashboard']) === false) { $params['dashboard'] = false; } - if (!isset($params['menu']) || $params['only_image']) { + if (isset($params['menu']) === false + || $params['only_image'] + ) { $params['menu'] = true; } else { $params['menu'] = false; } - if (!isset($params['vconsole']) || $params['vconsole'] == false) { + if (isset($params['vconsole']) === false + || $params['vconsole'] == false + ) { $params['vconsole'] = false; } else { $params['menu'] = false; } - if (!isset($params['type_graph'])) { + if (isset($params['type_graph']) === false) { $params['type_graph'] = $config['type_module_charts']; } - if (!isset($params['percentil'])) { + if (isset($params['percentil']) === false) { $params['percentil'] = null; } - if (!isset($params['fullscale'])) { + if (isset($params['fullscale']) === false) { $params['fullscale'] = false; } - if (!isset($params['id_widget_dashboard'])) { + if (isset($params['id_widget_dashboard']) === false) { $params['id_widget_dashboard'] = false; } - if (!isset($params['homeurl'])) { + if (isset($params['homeurl']) === false) { $params['homeurl'] = ui_get_full_url(false, false, false, false); } - if (!isset($params['show_legend'])) { + if (isset($params['show_legend']) === false) { $params['show_legend'] = true; } - if (!isset($params['show_overview'])) { + if (isset($params['show_overview']) === false) { $params['show_overview'] = true; } - if (!isset($params['show_export_csv'])) { + if (isset($params['show_export_csv']) === false) { $params['show_export_csv'] = true; } - if (!isset($params['return_img_base_64'])) { + if (isset($params['return_img_base_64']) === false) { $params['return_img_base_64'] = false; } - if (!isset($params['image_treshold'])) { + if (isset($params['image_treshold']) === false) { $params['image_treshold'] = false; } - if (!isset($params['show_unknown'])) { + if (isset($params['show_unknown']) === false) { $params['show_unknown'] = false; } - if (!isset($params['type_mode_graph'])) { + if (isset($params['type_mode_graph']) === false) { $params['type_mode_graph'] = 0; if (isset($params['graph_render']) === true) { $params['type_mode_graph'] = $params['graph_render']; @@ -1293,6 +1306,10 @@ function graphic_combined_module( $params_combined['fullscale'] = $params['fullscale']; } + if (isset($params['maximum_y_axis']) === false) { + $params['maximum_y_axis'] = $config['maximum_y_axis']; + } + $params['graph_combined'] = true; $params_combined['graph_combined'] = true; @@ -1305,11 +1322,10 @@ function graphic_combined_module( ); } - if (!isset($params['zoom'])) { + if (isset($params['zoom']) === false) { $params['zoom'] = 1; } - // TODO: Configurable. $params['grid_color'] = '#C1C1C1'; $params['legend_color'] = '#636363'; @@ -1454,23 +1470,23 @@ function graphic_combined_module( $params_combined['modules_id'] = $modules; } - if (isset($summatory)) { + if (isset($summatory) === true) { $params_combined['summatory'] = $summatory; } - if (isset($average)) { + if (isset($average) === true) { $params_combined['average'] = $average; } - if (isset($modules_series)) { + if (isset($modules_series) === true) { $params_combined['modules_series'] = $modules_series; } - if (isset($labels)) { + if (isset($labels) === true) { $params_combined['labels'] = $labels; } - if (isset($weights)) { + if (isset($weights) === true) { $params_combined['weight_list'] = $weights; } @@ -1660,7 +1676,7 @@ function graphic_combined_module( } } - if (empty($array_data)) { + if (empty($array_data) === true) { if ($params_combined['return']) { return graph_nodata_image($width, $height); } @@ -4392,7 +4408,7 @@ function fullscale_data( // Avg count total. $count_data_total++; - if ($type_mode_graph && !$params['baseline']) { + if (!$params['baseline']) { // MIN. // max min. if ($min_value >= $min_value_max @@ -4460,7 +4476,7 @@ function fullscale_data( } } - if ($type_mode_graph && !$params['baseline']) { + if (!$params['baseline']) { if ((int) $type_mode_graph === 1 || (int) $type_mode_graph === 3) { $data['min'.$series_suffix]['min'] = $min_value_min; $data['min'.$series_suffix]['max'] = $min_value_max; diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 6cd5e482c9..8f5587d917 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -537,8 +537,6 @@ $.fn.VUseTooltip = function() { var color = item.series.color; - //console.log(item.series.xaxis.ticks[x].label); - /* "" + item.series.label + @@ -1003,6 +1001,7 @@ function pandoraFlotArea( var update_legend = {}; var force_integer = 0; var divisor = params.divisor; + var maximum_y_axis = params.maximum_y_axis; if (typeof divisor === "undefined") { divisor = 1000; @@ -1896,6 +1895,13 @@ function pandoraFlotArea( fill_color = "green"; } + if (typeof maximum_y_axis !== "undefined" && maximum_y_axis != 0) { + maximum_y_axis = + parseInt(value.max) > parseInt(maximum_y_axis) + ? parseInt(value.max) + : parseInt(maximum_y_axis); + } + switch (series_type[index]) { case "area": line_show = true; @@ -2044,6 +2050,10 @@ function pandoraFlotArea( } }; + if (typeof maximum_y_axis !== "undefined" && maximum_y_axis != 0) { + options.yaxis.max = maximum_y_axis; + } + if (vconsole) { options.grid["hoverable"] = false; options.grid["clickable"] = false;