Improved the graphs behaviour when rendered into the dashboard or the visual console

This commit is contained in:
Alejandro Gallardo Escobar 2016-05-30 15:24:51 +02:00
parent dd6fa27402
commit 285d7971e0
4 changed files with 105 additions and 195 deletions

View File

@ -1594,7 +1594,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,

View File

@ -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

View File

@ -239,32 +239,9 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
return '<img src="' . $no_data_image . '" />';
}
$menu = (!$dashboard && !$vconsole);
if ($flash_chart) {
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,
false,
$agent_module_id);
}
else {
if ($vconsole) {
return flot_area_simple_graph(
$chart_data,
$width,
@ -315,7 +292,6 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
"id_graph=" . $id_graph . "'>";
}
}
}
function stacked_area_graph($flash_chart, $chart_data, $width, $height,
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
@ -329,6 +305,8 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height,
return '<img src="' . $no_data_image . '" />';
}
$menu = (!$dashboard && !$vconsole);
if ($flash_chart) {
return flot_area_stacked_graph(
$chart_data,
@ -347,30 +325,7 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height,
'',
false,
'',
true,
$backgroundColor,
$dashboard);
}
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,
$menu,
$backgroundColor,
$dashboard,
$vconsole,
@ -399,7 +354,6 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height,
"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 = "",
@ -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,30 +387,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height,
'',
false,
'',
true,
$background_color,
$dashboard);
}
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,
$menu,
$background_color,
$dashboard,
$vconsole);
@ -482,7 +414,6 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height,
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 = "",
@ -551,6 +482,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
return '<img src="' . $no_data_image . '" />';
}
$menu = (!$dashboard && !$vconsole);
if ($flash_chart) {
return flot_line_simple_graph(
$chart_data,
@ -569,30 +502,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
'',
false,
'',
true,
$backgroundColor,
$dashboard);
}
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,
$menu,
$backgroundColor,
$dashboard,
$vconsole);
@ -616,7 +526,6 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
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="") {

View File

@ -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)