fixed custom graph
This commit is contained in:
parent
30dc841bae
commit
b11e256c8b
|
@ -1008,29 +1008,7 @@ return $return;
|
|||
}
|
||||
}
|
||||
elseif ($type_graph === 'line') {
|
||||
if ($compare === 'separated') {
|
||||
return
|
||||
line_graph($flash_chart, $chart, $width, $height/2, $color,
|
||||
$legend, $long_index,
|
||||
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
||||
$title, $unit, $water_mark, $config['fontpath'],
|
||||
$config['font_size'], $unit, $ttl, $homeurl, $backgroundColor).
|
||||
'<br>'.
|
||||
line_graph($flash_chart, $chart_prev, $width, $height/2, $color,
|
||||
$legend, $long_index,
|
||||
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
||||
$title, $unit, $water_mark, $config['fontpath'],
|
||||
$config['font_size'], $unit, $ttl, $homeurl, $backgroundColor);
|
||||
}
|
||||
else {
|
||||
// Color commented not to restrict serie colors
|
||||
return
|
||||
line_graph($flash_chart, $chart, $width, $height, $color,
|
||||
$legend, $long_index,
|
||||
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
||||
$title, $unit, $water_mark, $config['fontpath'],
|
||||
$config['font_size'], $unit, $ttl, $homeurl, $backgroundColor);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1098,7 +1076,6 @@ function graphic_combined_module ( $module_list, $weight_list, $period, $width,
|
|||
|
||||
//XXX colocar
|
||||
/*
|
||||
$stacked
|
||||
$prediction_period
|
||||
$name_list
|
||||
$unit_list
|
||||
|
@ -1112,7 +1089,6 @@ function graphic_combined_module ( $module_list, $weight_list, $period, $width,
|
|||
$modules_series
|
||||
*/
|
||||
|
||||
html_debug_print($stacked);
|
||||
html_debug_print($name_list);
|
||||
html_debug_print($unit_list);
|
||||
html_debug_print($from_interface);
|
||||
|
@ -1134,9 +1110,7 @@ html_debug_print($from_interface);
|
|||
$show_elements_graph['show_unknown'] = false; // dont use
|
||||
$show_elements_graph['avg_only'] = false; // dont use
|
||||
$show_elements_graph['fullscale'] = $fullscale;
|
||||
//XXXX
|
||||
$show_elements_graph['show_title'] = $show_title; // dont use
|
||||
|
||||
$show_elements_graph['show_title'] = ''; // dont use
|
||||
$show_elements_graph['menu'] = $menu; // dont use
|
||||
$show_elements_graph['adapt_key'] = ''; // dont use
|
||||
$show_elements_graph['percentil'] = $percentil;
|
||||
|
@ -1150,6 +1124,7 @@ html_debug_print($from_interface);
|
|||
$show_elements_graph['return_data'] = true; //dont use
|
||||
$show_elements_graph['id_widget'] = $id_widget_dashboard;
|
||||
$show_elements_graph['labels'] = $labels;
|
||||
$show_elements_graph['stacked'] = $stacked;
|
||||
|
||||
$format_graph = array();
|
||||
$format_graph['width'] = $width;
|
||||
|
@ -1159,7 +1134,6 @@ html_debug_print($from_interface);
|
|||
|
||||
$format_graph['unit_name'] = $unit_name;
|
||||
$format_graph['unit'] = ''; //dont use
|
||||
|
||||
$format_graph['title'] = $title;
|
||||
$format_graph['homeurl'] = $homeurl;
|
||||
$format_graph['ttl'] = $ttl;
|
||||
|
@ -1167,7 +1141,7 @@ html_debug_print($from_interface);
|
|||
$format_graph['font'] = $config['fontpath'];
|
||||
$format_graph['font-size'] = $config['font_size'];
|
||||
|
||||
/*
|
||||
//for flash_charts
|
||||
$user = users_get_user_by_id($config['id_user']);
|
||||
$user_flash_charts = $user['flash_chart'];
|
||||
|
||||
|
@ -1181,12 +1155,10 @@ html_debug_print($from_interface);
|
|||
if ($only_image) {
|
||||
$flash_charts = false;
|
||||
}
|
||||
*/
|
||||
|
||||
$i=0;
|
||||
$array_data = array();
|
||||
foreach ($module_list as $key => $agent_module_id) {
|
||||
|
||||
$module_data = db_get_row_sql (
|
||||
'SELECT * FROM tagente_modulo
|
||||
WHERE id_agente_modulo = ' .
|
||||
|
@ -1882,37 +1854,17 @@ html_debug_print($from_interface);
|
|||
}
|
||||
|
||||
switch ($stacked) {
|
||||
default:
|
||||
case CUSTOM_GRAPH_STACKED_LINE:
|
||||
case CUSTOM_GRAPH_STACKED_AREA:
|
||||
case CUSTOM_GRAPH_AREA:
|
||||
case CUSTOM_GRAPH_LINE:
|
||||
return area_graph($agent_module_id, $array_data, $color,
|
||||
$legend, $series_type, $date_array,
|
||||
$data_module_graph, $show_elements_graph,
|
||||
$format_graph, $water_mark, $series_suffix_str,
|
||||
$array_events_alerts);
|
||||
break;
|
||||
default:
|
||||
case CUSTOM_GRAPH_STACKED_AREA:
|
||||
html_debug_print('entra por akiiii');
|
||||
return stacked_area_graph($flash_charts, $array_data,
|
||||
$width, $height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
||||
$title, "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl, $background_color,$dashboard, $vconsole);
|
||||
break;
|
||||
case CUSTOM_GRAPH_LINE:
|
||||
return line_graph($flash_charts, $graph_values, $width,
|
||||
$height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
||||
$title, "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
$unit, $ttl, $homeurl, $background_color, $dashboard,
|
||||
$vconsole, $series_type, $percentil_result, $yellow_threshold, $red_threshold, $threshold_data);
|
||||
break;
|
||||
case CUSTOM_GRAPH_STACKED_LINE:
|
||||
return stacked_line_graph($flash_charts, $graph_values,
|
||||
$width, $height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl, $background_color, $dashboard, $vconsole);
|
||||
break;
|
||||
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
||||
case CUSTOM_GRAPH_BULLET_CHART:
|
||||
return stacked_bullet_chart($flash_charts, $graph_values,
|
||||
|
|
|
@ -250,6 +250,8 @@ function area_graph(
|
|||
else {
|
||||
//XXXXX
|
||||
//Corregir este problema
|
||||
//tener en cuenta stacked, area, line
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
|
@ -278,132 +280,6 @@ function area_graph(
|
|||
}
|
||||
}
|
||||
|
||||
function stacked_area_graph($flash_chart, $chart_data, $width, $height,
|
||||
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||
$dashboard = false, $vconsole = false, $agent_module_id) {
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
}
|
||||
|
||||
$menu = (!$dashboard && !$vconsole);
|
||||
|
||||
if ($flash_chart) {
|
||||
return flot_area_stacked_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$font,
|
||||
$font_size,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
array(),
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
$menu,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
$vconsole,
|
||||
$agent_module_id);
|
||||
}
|
||||
else {
|
||||
//Stack the data
|
||||
stack_data($chart_data, $legend, $color);
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['backgroundColor'] = $backgroundColor;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . ui_get_full_url (false, false, false, false) .
|
||||
"include/graphs/functions_pchart.php?static_graph=1&graph_type=stacked_area&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
||||
}
|
||||
}
|
||||
|
||||
function stacked_line_graph($flash_chart, $chart_data, $width, $height,
|
||||
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||
$dashboard = false, $vconsole = false) {
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
}
|
||||
|
||||
$menu = (!$dashboard && !$vconsole);
|
||||
|
||||
if ($flash_chart) {
|
||||
return flot_line_stacked_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$font,
|
||||
$font_size,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
array(),
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
$menu,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
}
|
||||
else {
|
||||
//Stack the data
|
||||
stack_data($chart_data, $legend, $color);
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['backgroundColor'] = $backgroundColor;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
||||
}
|
||||
}
|
||||
|
||||
function stacked_bullet_chart($flash_chart, $chart_data, $width, $height,
|
||||
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
|
@ -487,77 +363,6 @@ function stacked_gauge($flash_chart, $chart_data, $width, $height,
|
|||
);
|
||||
}
|
||||
|
||||
function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $no_data_image, $xaxisname = "",
|
||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||
$dashboard = false, $vconsole = false, $series_type = array(),
|
||||
$percentil_values = array(), $yellow_threshold = 0, $red_threshold = 0,
|
||||
$threshold_data = array()) {
|
||||
|
||||
include_once("functions_flot.php");
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
}
|
||||
|
||||
$menu = (!$dashboard && !$vconsole);
|
||||
|
||||
if ($flash_chart) {
|
||||
return flot_line_simple_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$font,
|
||||
$font_size,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
$series_type,
|
||||
array(),
|
||||
$yellow_threshold,
|
||||
$red_threshold,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
$menu,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
$vconsole,
|
||||
false,
|
||||
$percentil_values,
|
||||
$threshold_data,
|
||||
$xaxisname);
|
||||
}
|
||||
else {
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['backgroundColor'] = $backgroundColor;
|
||||
$graph['percentil'] = $percentil_values;
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
if(empty($homeurl)){
|
||||
return "<img src='" . ui_get_full_url (false, false, false, false) . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
||||
}else{
|
||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function kiviat_graph($graph_type, $flash_chart, $chart_data, $width,
|
||||
$height, $no_data_image, $ttl = 1, $homedir="") {
|
||||
|
||||
|
|
|
@ -1143,6 +1143,7 @@ function pandoraFlotArea(
|
|||
var dashboard = show_elements_graph.dashboard;
|
||||
var menu = show_elements_graph.menu;
|
||||
var max_x = date_array['final_date'] *1000;
|
||||
var type = show_elements_graph.stacked;
|
||||
|
||||
//for threshold
|
||||
var threshold = true;
|
||||
|
@ -1155,30 +1156,29 @@ function pandoraFlotArea(
|
|||
var red_inverse = parseInt (data_module_graph.c_inv);
|
||||
|
||||
//XXXX ver que hay que hacer
|
||||
var type = 'area_simple';
|
||||
var labels_long = '';
|
||||
var min_check = 0;
|
||||
var water_mark = '';
|
||||
|
||||
var legend_events = null;
|
||||
var legend_alerts = null;
|
||||
|
||||
switch (type) {
|
||||
case 'line_simple':
|
||||
stacked = null;
|
||||
filled = false;
|
||||
case 2:
|
||||
stacked = null;
|
||||
filled_s = false;
|
||||
break;
|
||||
case 'line_stacked':
|
||||
stacked = 'stack';
|
||||
filled = false;
|
||||
case 3:
|
||||
stacked = 'stack';
|
||||
filled_s = false;
|
||||
break;
|
||||
case 'area_simple':
|
||||
stacked = null;
|
||||
filled = true;
|
||||
default:
|
||||
case 0:
|
||||
stacked = null;
|
||||
filled_s = 0.2;
|
||||
break;
|
||||
case 'area_stacked':
|
||||
stacked = 'stack';
|
||||
filled = true;
|
||||
case 1:
|
||||
stacked = 'stack';
|
||||
filled_s = 0.2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1203,7 +1203,7 @@ function pandoraFlotArea(
|
|||
case 'area':
|
||||
line_show = true;
|
||||
points_show = false; // XXX - false
|
||||
filled = 0.2;
|
||||
filled = filled_s;
|
||||
steps_chart = false;
|
||||
radius = false;
|
||||
fill_points = fill_color;
|
||||
|
@ -1230,7 +1230,7 @@ function pandoraFlotArea(
|
|||
case 'boolean':
|
||||
line_show = true;
|
||||
points_show = false;
|
||||
filled = true;
|
||||
filled = false;
|
||||
steps_chart = true;
|
||||
radius = false;
|
||||
fill_points = fill_color;
|
||||
|
@ -2561,7 +2561,6 @@ function pad(input, length, padding) {
|
|||
}
|
||||
// Recalculate the threshold data depends on warning and critical
|
||||
function axis_thresholded (threshold_data, y_min, y_max, red_threshold, extremes, red_up) {
|
||||
|
||||
var y = {
|
||||
min: 0,
|
||||
max: 0
|
||||
|
@ -2617,6 +2616,7 @@ function axis_thresholded (threshold_data, y_min, y_max, red_threshold, extremes
|
|||
|
||||
return y;
|
||||
}
|
||||
|
||||
function add_threshold (data_base, threshold_data, y_min, y_max,
|
||||
red_threshold, extremes, red_up) {
|
||||
|
||||
|
@ -2637,7 +2637,7 @@ function add_threshold (data_base, threshold_data, y_min, y_max,
|
|||
if (/_down/.test(this.id)){
|
||||
var end;
|
||||
if (/critical/.test(this.id)) {
|
||||
end = red_threshold;
|
||||
end = red_threshold;
|
||||
} else {
|
||||
end = extremes[this.id];
|
||||
}
|
||||
|
|
|
@ -98,84 +98,6 @@ function include_javascript_dependencies_flot_graph($return = false) {
|
|||
///////////////////////////////
|
||||
////////// AREA GRAPHS ////////
|
||||
///////////////////////////////
|
||||
function flot_area_stacked_graph($chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $homeurl = '', $font = '', $font_size = 7,
|
||||
$unit = '', $water_mark = '', $serie_types = array(),
|
||||
$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) {
|
||||
|
||||
global $config;
|
||||
|
||||
return flot_area_graph($chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $homeurl, $unit, 'area_stacked',
|
||||
$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);
|
||||
}
|
||||
|
||||
function flot_area_simple_graph($chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $homeurl = '', $unit = '', $water_mark = '',
|
||||
$serie_types = array(), $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, $font = '', $font_size = 7, $xaxisname = '',
|
||||
$percentil_values = array(), $threshold_data = array()) {
|
||||
|
||||
global $config;
|
||||
|
||||
return flot_area_graph($chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $homeurl, $unit, 'area_simple',
|
||||
$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, $xaxisname, $percentil_values,
|
||||
$threshold_data);
|
||||
}
|
||||
|
||||
function flot_line_stacked_graph($chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $homeurl = '', $font = '', $font_size = 7,
|
||||
$unit = '', $water_mark = '', $serie_types = array(),
|
||||
$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,
|
||||
$xaxisname = "") {
|
||||
|
||||
global $config;
|
||||
|
||||
return flot_area_graph($chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $homeurl, $unit, 'line_stacked',
|
||||
$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, $xaxisname);
|
||||
}
|
||||
|
||||
function flot_line_simple_graph($chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $homeurl = '', $font = '', $font_size = 7,
|
||||
$unit = '', $water_mark = '', $serie_types = array(),
|
||||
$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,
|
||||
$percentil_values = array(), $threshold_data = array(),
|
||||
$xaxisname = '') {
|
||||
|
||||
global $config;
|
||||
|
||||
return flot_area_graph($chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $homeurl, $unit, 'line_simple',
|
||||
$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, $xaxisname, $percentil_values,
|
||||
$threshold_data);
|
||||
}
|
||||
|
||||
function flot_area_graph (
|
||||
$agent_module_id, $array_data, $color,
|
||||
$legend, $series_type, $date_array,
|
||||
|
|
Loading…
Reference in New Issue