diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 33118d39c2..e8fa13df9f 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -513,6 +513,8 @@ function grafico_modulo_sparse_data( } $period_time_interval = $period_time_interval - $params['time_interval']; } + //drag the last value to paint the graph correctly + $acum_array_data[]= array( 0 => $start_period, 1 => $acum_array_data[$i-1][1]); $array_data['sum1']['data'] = $acum_array_data; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 16b12d1c08..d385b424be 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -3854,114 +3854,114 @@ function reporting_value($report, $content, $type,$pdf) { 'type_graph' => $config['type_module_charts'], 'time_interval' => $content['lapse'], 'server_id' => $id_meta, - 'height' => $config['graph_image_height'] + 'height' => $config['graph_image_height'], + 'fullscale' => true ); switch ($type) { case 'max': - if($content['lapse_calc'] == 0){ - $value = reporting_get_agentmodule_data_max( - $content['id_agent_module'], $content['period'], $report["datetime"]); - if (!$config['simple_module_value']) { - $formated_value = $value; + if($content['lapse_calc'] == 0){ + $value = reporting_get_agentmodule_data_max( + $content['id_agent_module'], $content['period'], $report["datetime"]); + if (!$config['simple_module_value']) { + $formated_value = $value; + } + else { + $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; + } } - else { - $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; - } - } - else{ - $value = ' - - - - - - - - - -
'; - if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){ + else{ + $value = ' + + + + + + +
'; + if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + + + + + +
+ '.__("Agent").' + + '.__("Module").' + + '.__("Maximum").' +
+ '.$agent_name.' + + '.$module_name.' + + '.format_for_graph(reporting_get_agentmodule_data_max( + $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.' +
'; + } + + $value .= ' +
+ '; + + if($content['visual_format'] == 2 || $content['visual_format'] == 3){ + $params['force_interval'] = 'max_only'; + $value .= grafico_modulo_sparse($params); + } $value .= ' - + + + + + '; + $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module'], true); + $date_reference = getdate(); + + for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) { + + $value .= ''; + } else { + $value .= 'N/A'; + } + + } + + $value .='
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 3){ + + $value .= ' + - - - - - -
- '.__("Agent").' - - '.__("Module").' + '.__("Lapse").' '.__("Maximum").'
- '.$agent_name.' - - '.$module_name.' - - '.format_for_graph(reporting_get_agentmodule_data_max( - $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.' -
'; +
'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).''; + + if ($i>$time_begin['utimestamp']) { + $value .= format_for_graph(reporting_get_agentmodule_data_max( + $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'
'; } + $value .= ' +
'; - $value .= ' -
- '; + $formated_value = $value; + } - if($content['visual_format'] == 2 || $content['visual_format'] == 3){ - $params['force_interval'] = 'max_only'; - $value .= grafico_modulo_sparse($params); - } - - $value .= ' - -
'; - - if($content['visual_format'] == 1 || $content['visual_format'] == 3){ - - $value .= ' - - - - - - '; - $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']); - $date_reference = getdate(); - - for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) { - - $value .= ''; - } - else{ - $value .= 'N/A'; - } - - } - - $value .='
- '.__("Lapse").' - - '.__("Maximum").' -
'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).''; - - if($i>$time_begin['utimestamp']){ - $value .= format_for_graph(reporting_get_agentmodule_data_max( - $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'
'; - } - $value .= ' -
'; - - $formated_value = $value; - } - - break; + break; case 'min': if($content['lapse_calc'] == 0){ $value = reporting_get_agentmodule_data_min( @@ -4072,111 +4072,111 @@ function reporting_value($report, $content, $type,$pdf) { break; case 'avg': - if($content['lapse_calc'] == 0){ - $value = reporting_get_agentmodule_data_average( - $content['id_agent_module'], $content['period'], $report["datetime"]); - if (!$config['simple_module_value']) { - $formated_value = $value; + if($content['lapse_calc'] == 0){ + $value = reporting_get_agentmodule_data_average( + $content['id_agent_module'], $content['period'], $report["datetime"]); + if (!$config['simple_module_value']) { + $formated_value = $value; + } + else { + $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; + } } - else { - $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; - } - } - else{ - $value = ' - - - - - - - -
'; + else{ + $value = ' + + + + + - - + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){ + $value .= ' + + + + + + + + + + +
+ '.__("Agent").' + + '.__("Module").' + + '.__("Average").' +
+ '.$agent_name.' + + '.$module_name.' + + '.format_for_graph(reporting_get_agentmodule_data_average( + $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.' +
'; + + } + + $value .= ' +
+ '; + if($content['visual_format'] == 2 || $content['visual_format'] == 3){ + $params['force_interval'] = 'avg_only'; + $value .= grafico_modulo_sparse($params); + } - if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){ $value .= ' - + + + + + '; + $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']); + $date_reference = getdate(); + + for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) { + + $value .= ''; + } + else{ + $value .= 'N/A'; + } + + } + + $value .='
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 3){ + + $value .= ' + - - - - - -
- '.__("Agent").' - - '.__("Module").' + '.__("Lapse").' '.__("Average").'
- '.$agent_name.' - - '.$module_name.' - - '.format_for_graph(reporting_get_agentmodule_data_average( - $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.' -
'; - +
'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).''; + + if($i>$time_begin['utimestamp']){ + $value .= format_for_graph(reporting_get_agentmodule_data_average( + $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'
'; } - $value .= ' -
- '; - if($content['visual_format'] == 2 || $content['visual_format'] == 3){ - $params['force_interval'] = 'avg_only'; - $value .= grafico_modulo_sparse($params); - } + $value .= ' + +
'; - $value .= ' - -
'; - - if($content['visual_format'] == 1 || $content['visual_format'] == 3){ - - $value .= ' - - - - - - '; - $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']); - $date_reference = getdate(); - - for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) { - - $value .= ''; - } - else{ - $value .= 'N/A'; - } - - } - - $value .='
- '.__("Lapse").' - - '.__("Average").' -
'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).''; - - if($i>$time_begin['utimestamp']){ - $value .= format_for_graph(reporting_get_agentmodule_data_average( - $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'
'; - } - - $value .= ' - -
'; + $formated_value = $value; - $formated_value = $value; - - } - break; + } + break; case 'sum': $value = reporting_get_agentmodule_data_sum(