tip in graph interfaces

This commit is contained in:
daniel 2017-09-21 15:35:28 +02:00
parent d34f34f4cb
commit 9337d33ceb
3 changed files with 779 additions and 712 deletions

View File

@ -164,7 +164,7 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$background_color = 'white', $modules_param = array(), $homeurl = '',
$name_list = array(), $unit_list = array(), $show_last = true,
$show_max = true, $show_min = true, $show_avg = true, $ttl = 1,
$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false,$id_widget_dashboard=false) {
$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false,$id_widget_dashboard=false, $fullscale = false) {
global $config;
@ -261,7 +261,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$vconsole,
$percentil,
$from_interface,
$id_widget_dashboard);
$id_widget_dashboard,
$fullscale);
if ($return)
return $output;

View File

@ -1055,11 +1055,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$prediction_period = false, $background_color = 'white',
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
$show_min = true, $show_avg = true, $labels = array(), $dashboard = false,
$vconsole = false, $percentil = null, $from_interface = false, $id_widget_dashboard=false) {
$vconsole = false, $percentil = null, $from_interface = false,
$id_widget_dashboard=false, $fullscale = false) {
global $config;
global $graphic_type;
if(!$fullscale){
$time_format_2 = '';
$temp_range = $period;
@ -1161,7 +1163,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$graph[$timestamp]['event'] = 0;
$graph[$timestamp]['alert'] = 0;
}
$long_index = array();
$graph_values = array();
@ -1243,6 +1244,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
"utimestamp < $date",
'order' => 'utimestamp ASC'),
array ('datos', 'utimestamp'), 'AND', $search_in_history_db);
if ($data === false) {
$data = array ();
}
@ -1360,7 +1362,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
// Calculate chart data
$last_known = $previous_data;
for ($l = 0; $l <= $resolution; $l++) {
$countAvg ++;
@ -1831,6 +1832,28 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
break;
}
}
else{
$temp = fullscale_data_combined($module_list, $period, $date);
$resolution = count($temp); //Number of points of the graph
$interval = (int) ($period / $resolution);
$module_name_list = array();
$flash_charts = true;
foreach ($module_list as $key => $value) {
$agent_name = io_safe_output( modules_get_agentmodule_agent_name ($value) );
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
$module_name = io_safe_output( modules_get_agentmodule_name ($value) );
if ($flash_charts){
$module_name_list[$key] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $alias . " / " . $module_name. '</span>';
}
else{
$module_name_list[$key] = $alias . " / " . $module_name;
}
}
}
$graph_values = $temp;
@ -2081,6 +2104,41 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
}
function fullscale_data_combined($module_list, $period, $date){
// Set variables
if ($date == 0){
$date = get_system_time();
}
$datelimit = $date - $period;
foreach ($module_list as $key_module => $value_module) {
$data_uncompress = db_uncompress_module_data($value_module, $datelimit, $date);
foreach ($data_uncompress as $key_data => $value_data) {
foreach ($value_data['data'] as $k => $v) {
$real_date = date("Y M d H:i:s", $v['utimestamp']);
$data_all[$real_date][$key_module] = $v['datos'];
}
}
}
$data_prev = array();
foreach ($data_all as $key => $value) {
foreach ($module_list as $key_module => $value_module) {
if(!isset($value[$key_module])){
$data_all[$key][$key_module] = $data_prev[$key_module];
}
else{
$data_prev[$key_module] = $value[$key_module];
}
}
}
return $data_all;
}
/**
* Print a graph with access data of agents
*
@ -4331,7 +4389,6 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index,
$series_type['percentil' . $series_suffix] = 'line';
}
}
//html_debug_print($chart_data);
}
function grafico_modulo_boolean ($agent_module_id, $period, $show_events,

View File

@ -150,6 +150,7 @@ $interface_traffic_modules = array(
$zoom = (int) get_parameter ("zoom", 1);
$baseline = get_parameter ("baseline", 0);
$show_percentil = get_parameter ("show_percentil", 0);
$fullscale = get_parameter("fullscale", 0);
if ($zoom > 1) {
$height = $height * ($zoom / 2.1);
@ -200,7 +201,9 @@ $interface_traffic_modules = array(
false,
false,
(($show_percentil)? $config['percentil'] : null),
true);
true,
false,
$fullscale);
echo '</div>';
@ -259,6 +262,12 @@ $interface_traffic_modules = array(
$table->data[] = $data;
$table->rowclass[] ='';
$data = array();
$data[0] = __('Full scale');
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, true);
$table->data[] = $data;
$table->rowclass[] ='';
$data = array();
$data[0] = __('Zoom factor');
$options = array();