mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Improved the graphs behaviour when rendered into the dashboard or the visual console
This commit is contained in:
parent
dd6fa27402
commit
285d7971e0
@ -1594,7 +1594,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
'color' => COL_GRAPH13,
|
'color' => COL_GRAPH13,
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
'alpha' => CHART_DEFAULT_ALPHA);
|
||||||
|
|
||||||
|
|
||||||
switch ($stacked) {
|
switch ($stacked) {
|
||||||
case CUSTOM_GRAPH_AREA:
|
case CUSTOM_GRAPH_AREA:
|
||||||
return area_graph($flash_charts, $graph_values, $width,
|
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) {
|
if ($layoutData['id_custom_graph'] != 0) {
|
||||||
|
// Show only avg on the visual console
|
||||||
$img = custom_graphs_print(
|
$img = custom_graphs_print(
|
||||||
$layoutData['id_custom_graph'], $height, $width,
|
$layoutData['id_custom_graph'], $height, $width,
|
||||||
$period, null, true, 0, true, $layoutData['image'],
|
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||||
array(), '', array(), array(), true,
|
array(), '', array(), array(), false,
|
||||||
true, true, true, 1, false, $graph_javascript);
|
false, false, true, 1, false, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($isExternalLink)
|
if ($isExternalLink)
|
||||||
@ -783,8 +785,8 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
|
|
||||||
$img = grafico_modulo_sparse($id_module, $period, 0, $width,
|
$img = grafico_modulo_sparse($id_module, $period, 0, $width,
|
||||||
$height, '', null, false, 1, false, 0, '', 0, 0,
|
$height, '', null, false, 1, false, 0, '', 0, 0,
|
||||||
true, true, $homeurl, 1, false, '', false, false, true,
|
true, $only_image, $homeurl, 1, false, '', false, false, false,
|
||||||
$layoutData['image'], null, false, $graph_javascript);
|
$layoutData['image'], null, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restore db connection
|
//Restore db connection
|
||||||
|
@ -239,6 +239,8 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||||||
return '<img src="' . $no_data_image . '" />';
|
return '<img src="' . $no_data_image . '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$menu = (!$dashboard && !$vconsole);
|
||||||
|
|
||||||
if ($flash_chart) {
|
if ($flash_chart) {
|
||||||
return flot_area_simple_graph(
|
return flot_area_simple_graph(
|
||||||
$chart_data,
|
$chart_data,
|
||||||
@ -260,60 +262,34 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||||||
$menu,
|
$menu,
|
||||||
$backgroundColor,
|
$backgroundColor,
|
||||||
$dashboard,
|
$dashboard,
|
||||||
false,
|
$vconsole,
|
||||||
$agent_module_id);
|
$agent_module_id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($vconsole) {
|
$graph = array();
|
||||||
return flot_area_simple_graph(
|
$graph['data'] = $chart_data;
|
||||||
$chart_data,
|
$graph['width'] = $width;
|
||||||
$width,
|
$graph['height'] = $height;
|
||||||
$height,
|
$graph['color'] = $color;
|
||||||
$color,
|
$graph['legend'] = $legend;
|
||||||
$legend,
|
$graph['xaxisname'] = $xaxisname;
|
||||||
$long_index,
|
$graph['yaxisname'] = $yaxisname;
|
||||||
$homeurl,
|
$graph['water_mark'] = $water_mark_file;
|
||||||
$unit,
|
$graph['font'] = $font;
|
||||||
$water_mark_url,
|
$graph['font_size'] = $font_size;
|
||||||
$series_type,
|
$graph['backgroundColor'] = $backgroundColor;
|
||||||
$chart_extra_data,
|
$graph['unit'] = $unit;
|
||||||
$yellow_threshold,
|
$graph['series_type'] = $series_type;
|
||||||
$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);
|
$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='(.+)'>/"
|
// 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='" .
|
return "<img src='" .
|
||||||
ui_get_full_url (false, false, false, false) .
|
ui_get_full_url (false, false, false, false) .
|
||||||
"include/graphs/functions_pchart.php?" .
|
"include/graphs/functions_pchart.php?" .
|
||||||
"static_graph=1&" .
|
"static_graph=1&" .
|
||||||
"graph_type=area&" .
|
"graph_type=area&" .
|
||||||
"ttl=" . $ttl . "&" .
|
"ttl=" . $ttl . "&" .
|
||||||
"id_graph=" . $id_graph . "'>";
|
"id_graph=" . $id_graph . "'>";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,6 +305,8 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height,
|
|||||||
return '<img src="' . $no_data_image . '" />';
|
return '<img src="' . $no_data_image . '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$menu = (!$dashboard && !$vconsole);
|
||||||
|
|
||||||
if ($flash_chart) {
|
if ($flash_chart) {
|
||||||
return flot_area_stacked_graph(
|
return flot_area_stacked_graph(
|
||||||
$chart_data,
|
$chart_data,
|
||||||
@ -347,57 +325,33 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height,
|
|||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
true,
|
$menu,
|
||||||
$backgroundColor,
|
$backgroundColor,
|
||||||
$dashboard);
|
$dashboard,
|
||||||
|
$vconsole,
|
||||||
|
$agent_module_id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($vconsole) {
|
//Stack the data
|
||||||
return flot_area_stacked_graph(
|
stack_data($chart_data, $legend, $color);
|
||||||
$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 = array();
|
||||||
$graph['data'] = $chart_data;
|
$graph['data'] = $chart_data;
|
||||||
$graph['width'] = $width;
|
$graph['width'] = $width;
|
||||||
$graph['height'] = $height;
|
$graph['height'] = $height;
|
||||||
$graph['color'] = $color;
|
$graph['color'] = $color;
|
||||||
$graph['legend'] = $legend;
|
$graph['legend'] = $legend;
|
||||||
$graph['xaxisname'] = $xaxisname;
|
$graph['xaxisname'] = $xaxisname;
|
||||||
$graph['yaxisname'] = $yaxisname;
|
$graph['yaxisname'] = $yaxisname;
|
||||||
$graph['water_mark'] = $water_mark_file;
|
$graph['water_mark'] = $water_mark_file;
|
||||||
$graph['font'] = $font;
|
$graph['font'] = $font;
|
||||||
$graph['font_size'] = $font_size;
|
$graph['font_size'] = $font_size;
|
||||||
$graph['backgroundColor'] = $backgroundColor;
|
$graph['backgroundColor'] = $backgroundColor;
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||||
|
|
||||||
return "<img src='" . ui_get_full_url (false, false, false, false) .
|
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 . "' />";
|
"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 . '" />';
|
return '<img src="' . $no_data_image . '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$menu = (!$dashboard && !$vconsole);
|
||||||
|
|
||||||
if ($flash_chart) {
|
if ($flash_chart) {
|
||||||
return flot_line_stacked_graph(
|
return flot_line_stacked_graph(
|
||||||
@ -432,55 +387,31 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height,
|
|||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
true,
|
$menu,
|
||||||
$background_color,
|
$background_color,
|
||||||
$dashboard);
|
$dashboard,
|
||||||
|
$vconsole);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($vconsole) {
|
//Stack the data
|
||||||
return flot_line_stacked_graph(
|
stack_data($chart_data, $legend, $color);
|
||||||
$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 = array();
|
||||||
$graph['data'] = $chart_data;
|
$graph['data'] = $chart_data;
|
||||||
$graph['width'] = $width;
|
$graph['width'] = $width;
|
||||||
$graph['height'] = $height;
|
$graph['height'] = $height;
|
||||||
$graph['color'] = $color;
|
$graph['color'] = $color;
|
||||||
$graph['legend'] = $legend;
|
$graph['legend'] = $legend;
|
||||||
$graph['xaxisname'] = $xaxisname;
|
$graph['xaxisname'] = $xaxisname;
|
||||||
$graph['yaxisname'] = $yaxisname;
|
$graph['yaxisname'] = $yaxisname;
|
||||||
$graph['water_mark'] = $water_mark_file;
|
$graph['water_mark'] = $water_mark_file;
|
||||||
$graph['font'] = $font;
|
$graph['font'] = $font;
|
||||||
$graph['font_size'] = $font_size;
|
$graph['font_size'] = $font_size;
|
||||||
$graph['backgroundColor'] = $backgroundColor;
|
$graph['backgroundColor'] = $backgroundColor;
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
$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 . "' />";
|
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,6 +482,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||||||
return '<img src="' . $no_data_image . '" />';
|
return '<img src="' . $no_data_image . '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$menu = (!$dashboard && !$vconsole);
|
||||||
|
|
||||||
if ($flash_chart) {
|
if ($flash_chart) {
|
||||||
return flot_line_simple_graph(
|
return flot_line_simple_graph(
|
||||||
$chart_data,
|
$chart_data,
|
||||||
@ -569,52 +502,28 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
true,
|
$menu,
|
||||||
$backgroundColor,
|
$backgroundColor,
|
||||||
$dashboard);
|
$dashboard,
|
||||||
|
$vconsole);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($vconsole) {
|
$graph = array();
|
||||||
return flot_line_simple_graph(
|
$graph['data'] = $chart_data;
|
||||||
$chart_data,
|
$graph['width'] = $width;
|
||||||
$width,
|
$graph['height'] = $height;
|
||||||
$height,
|
$graph['color'] = $color;
|
||||||
$color,
|
$graph['legend'] = $legend;
|
||||||
$legend,
|
$graph['xaxisname'] = $xaxisname;
|
||||||
$long_index,
|
$graph['yaxisname'] = $yaxisname;
|
||||||
$homeurl,
|
$graph['water_mark'] = $water_mark_file;
|
||||||
$unit,
|
$graph['font'] = $font;
|
||||||
$water_mark_url,
|
$graph['font_size'] = $font_size;
|
||||||
array(),
|
$graph['backgroundColor'] = $backgroundColor;
|
||||||
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);
|
$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 . "' />";
|
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']);
|
$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;
|
$vc_refr = false;
|
||||||
|
|
||||||
if (isset($config['vc_refr']) and $config['vc_refr'] != 0)
|
if (isset($config['vc_refr']) and $config['vc_refr'] != 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user