'; } $output .= ' '; // NOTE: jquery.flot.threshold is not te original file. Is patched to allow multiple thresholds and filled area $output .= ' '; // Chartjs. $output .= ''; $output .= ''; $output .= " "; if (!$return) { echo $output; } return $output; } } /** * Function create container for print charts. * * @param integer $agent_module_id Id module. * @param array $array_data Data. * @param array $legend Legend. * @param array $series_type Series. * @param array $color Color. * @param array $date_array Date. * @param array $data_module_graph Data module. * @param array $params Params. * @param string $water_mark Water. * @param array $array_events_alerts Events array. * * @return string Return graphs. */ function flot_area_graph( $agent_module_id, $array_data, $legend, $series_type, $color, $date_array, $data_module_graph, $params, $water_mark, $array_events_alerts ) { global $config; global $is_mobile; // Get a unique identifier to graph. $graph_id = uniqid('graph_'); $background_style = ''; switch ($params['backgroundColor']) { case 'white': $background_style = ' background: #fff; '; $params['grid_color'] = '#C1C1C1'; break; case 'black': $background_style = ' background: #000; '; $params['grid_color'] = '#BDBDBD'; break; case 'transparent': $background_style = ''; $params['grid_color'] = '#A4A4A4'; break; default: $background_style = 'background-color: '.$params['backgroundColor']; $params['grid_color'] = '#C1C1C1'; break; } if (($config['style'] === 'pandora_black' && !is_metaconsole()) && ($params['pdf'] === false || $params['pdf'] === null) && (isset($is_mobile) === false || $is_mobile === false) ) { $background_style = '#222'; $params['grid_color'] = '#fff'; $params['backgroundColor'] = '#222'; $params['legend_color'] = '#fff'; } else if ($params['pdf']) { $params['legend_color'] = '#000'; } // Parent layer. if (strpos($params['width'], '%') === false) { $width = 'width: '.$params['width'].'px;'; } else { $width = 'width: '.$params['width'].';'; } $return = "
'.$params['title'].'
'; } // Set some containers to legend, graph, timestamp tooltip, etc. if ($params['show_legend']) { $return .= ''; } if (isset($params['graph_combined']) === true && $params['graph_combined'] && (isset($params['from_interface']) === false || !$params['from_interface']) ) { if (isset($params['threshold_data']) === true && is_array($params['threshold_data']) === true ) { $yellow_threshold = $params['threshold_data']['yellow_threshold']; $red_threshold = $params['threshold_data']['red_threshold']; $yellow_up = $params['threshold_data']['yellow_up']; $red_up = $params['threshold_data']['red_up']; $yellow_inverse = $params['threshold_data']['yellow_inverse']; $red_inverse = $params['threshold_data']['red_inverse']; } else { $yellow_up = 0; $red_up = 0; $yellow_inverse = false; $red_inverse = false; } } else if (isset($params['combined']) === false || !$params['combined']) { $yellow_threshold = $data_module_graph['w_min']; $red_threshold = $data_module_graph['c_min']; // Get other required module datas to draw warning and critical. if ($agent_module_id == 0) { $yellow_up = 0; $red_up = 0; $yellow_inverse = false; $red_inverse = false; } else { $yellow_up = $data_module_graph['w_max']; $red_up = $data_module_graph['c_max']; $yellow_inverse = !($data_module_graph['w_inv'] == 0); $red_inverse = !($data_module_graph['c_inv'] == 0); } } else if (isset($params['from_interface']) === true && $params['from_interface'] ) { if (isset($params['threshold_data']) === true && is_array($params['threshold_data']) ) { $yellow_threshold = $params['threshold_data']['yellow_threshold']; $red_threshold = $params['threshold_data']['red_threshold']; $yellow_up = $params['threshold_data']['yellow_up']; $red_up = $params['threshold_data']['red_up']; $yellow_inverse = $params['threshold_data']['yellow_inverse']; $red_inverse = $params['threshold_data']['red_inverse']; } else { $yellow_up = 0; $red_up = 0; $yellow_inverse = false; $red_inverse = false; } } else { $yellow_up = 0; $red_up = 0; $yellow_inverse = false; $red_inverse = false; } if ($params['menu']) { $return .= menu_graph( $yellow_threshold, $red_threshold, $yellow_up, $red_up, $yellow_inverse, $red_inverse, $graph_id, $params ); } $return .= html_print_input_hidden( 'line_width_graph', $config['custom_graph_width'], true ); $return .= ""; $return .= ""; $legend_top = 10; if (empty($params['show_legend']) === false) { $legend_top = (int) $params['height']; } if ($params['menu']) { $params['height'] = 100; } else { $params['height'] = 1; } if ((bool) $params['vconsole'] === false) { $return .= ''; if ($water_mark != '' && (bool) $params['dashboard'] === false) { $return .= '