Improved the graphs behaviour when rendered into the dashboard or the visual console
(cherry picked from commit 20128621395cf381d62f1e1b35064b2fb3a67ac1)
This commit is contained in:
parent
2b5d58279d
commit
267290a5dc
|
@ -1720,7 +1720,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
'color' => COL_GRAPH13,
|
||||
'alpha' => CHART_DEFAULT_ALPHA);
|
||||
|
||||
|
||||
switch ($stacked) {
|
||||
case CUSTOM_GRAPH_AREA:
|
||||
return area_graph($flash_charts, $graph_values, $width,
|
||||
|
|
|
@ -768,12 +768,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
}
|
||||
|
||||
$only_image = !$graph_javascript || $isExternalLink;
|
||||
if ($layoutData['id_custom_graph'] != 0) {
|
||||
// Show only avg on the visual console
|
||||
$img = custom_graphs_print(
|
||||
$layoutData['id_custom_graph'], $height, $width,
|
||||
$period, null, true, 0, true, $layoutData['image'],
|
||||
array(), '', array(), array(), true,
|
||||
true, true, true, 1, false, $graph_javascript);
|
||||
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||
array(), '', array(), array(), false,
|
||||
false, false, true, 1, false, true);
|
||||
}
|
||||
else {
|
||||
if ($isExternalLink)
|
||||
|
@ -783,8 +785,8 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
|
||||
$img = grafico_modulo_sparse($id_module, $period, 0, $width,
|
||||
$height, '', null, false, 1, false, 0, '', 0, 0,
|
||||
true, true, $homeurl, 1, false, '', false, false, true,
|
||||
$layoutData['image'], null, false, $graph_javascript);
|
||||
true, $only_image, $homeurl, 1, false, '', false, false, false,
|
||||
$layoutData['image'], null, false, true);
|
||||
}
|
||||
|
||||
//Restore db connection
|
||||
|
|
|
@ -238,6 +238,8 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
return graph_nodata_image($width, $height);
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
}
|
||||
|
||||
$menu = (!$dashboard && !$vconsole);
|
||||
|
||||
if ($flash_chart) {
|
||||
return flot_area_simple_graph(
|
||||
|
@ -260,60 +262,34 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$menu,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
false,
|
||||
$vconsole,
|
||||
$agent_module_id);
|
||||
}
|
||||
else {
|
||||
if ($vconsole) {
|
||||
return flot_area_simple_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
$series_type,
|
||||
$chart_extra_data,
|
||||
$yellow_threshold,
|
||||
$red_threshold,
|
||||
$adapt_key,
|
||||
$force_integer,
|
||||
$series_suffix_str,
|
||||
$menu,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
$vconsole,
|
||||
$agent_module_id);
|
||||
}
|
||||
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['unit'] = $unit;
|
||||
$graph['series_type'] = $series_type;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
// Warning: This string is used in the function "api_get_module_graph" from 'functions_api.php' with the regec patern "/<img src='(.+)'>/"
|
||||
return "<img src='" .
|
||||
ui_get_full_url (false, false, false, false) .
|
||||
"include/graphs/functions_pchart.php?" .
|
||||
"static_graph=1&" .
|
||||
"graph_type=area&" .
|
||||
"ttl=" . $ttl . "&" .
|
||||
"id_graph=" . $id_graph . "'>";
|
||||
}
|
||||
$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['unit'] = $unit;
|
||||
$graph['series_type'] = $series_type;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
// Warning: This string is used in the function "api_get_module_graph" from 'functions_api.php' with the regec patern "/<img src='(.+)'>/"
|
||||
return "<img src='" .
|
||||
ui_get_full_url (false, false, false, false) .
|
||||
"include/graphs/functions_pchart.php?" .
|
||||
"static_graph=1&" .
|
||||
"graph_type=area&" .
|
||||
"ttl=" . $ttl . "&" .
|
||||
"id_graph=" . $id_graph . "'>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,6 +304,8 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height,
|
|||
if (empty($chart_data)) {
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
}
|
||||
|
||||
$menu = (!$dashboard && !$vconsole);
|
||||
|
||||
if ($flash_chart) {
|
||||
return flot_area_stacked_graph(
|
||||
|
@ -347,57 +325,33 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height,
|
|||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
$menu,
|
||||
$backgroundColor,
|
||||
$dashboard);
|
||||
$dashboard,
|
||||
$vconsole,
|
||||
$agent_module_id);
|
||||
}
|
||||
else {
|
||||
if ($vconsole) {
|
||||
return flot_area_stacked_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
array(),
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
$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 . "' />";
|
||||
}
|
||||
//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 . "' />";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,6 +367,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height,
|
|||
return '<img src="' . $no_data_image . '" />';
|
||||
}
|
||||
|
||||
$menu = (!$dashboard && !$vconsole);
|
||||
|
||||
if ($flash_chart) {
|
||||
return flot_line_stacked_graph(
|
||||
|
@ -432,55 +387,31 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height,
|
|||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
$menu,
|
||||
$background_color,
|
||||
$dashboard);
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
}
|
||||
else {
|
||||
if ($vconsole) {
|
||||
return flot_line_stacked_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
array(),
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
$background_color,
|
||||
$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 . "' />";
|
||||
}
|
||||
//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 . "' />";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,6 +481,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
if (empty($chart_data)) {
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
}
|
||||
|
||||
$menu = (!$dashboard && !$vconsole);
|
||||
|
||||
if ($flash_chart) {
|
||||
return flot_line_simple_graph(
|
||||
|
@ -569,52 +502,28 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
$menu,
|
||||
$backgroundColor,
|
||||
$dashboard);
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
}
|
||||
else {
|
||||
if ($vconsole) {
|
||||
return flot_line_simple_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
array(),
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
}
|
||||
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;
|
||||
|
||||
$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 . "' />";
|
||||
}
|
||||
$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 . "' />";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ else {
|
|||
}
|
||||
|
||||
$refr = (int) get_parameter ('refr', $config['vc_refr']);
|
||||
$graph_javascript = (bool) get_parameter ('graph_javascript', false);
|
||||
$graph_javascript = (bool) get_parameter ('graph_javascript', true);
|
||||
$vc_refr = false;
|
||||
|
||||
if (isset($config['vc_refr']) and $config['vc_refr'] != 0)
|
||||
|
|
Loading…
Reference in New Issue