2012-01-03 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_graph.php include/functions_forecast.php include/functions_reporting.php: Fixed graphical representation of intervals in projection graphs. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5319 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
83d5e29cb4
commit
b876b1bbd9
|
@ -1,3 +1,10 @@
|
|||
2012-01-03 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/functions_graph.php
|
||||
include/functions_forecast.php
|
||||
include/functions_reporting.php: Fixed graphical representation of
|
||||
intervals in projection graphs.
|
||||
|
||||
2012-01-03 Vanessa Gil <vanessa.gil@artica.es>
|
||||
* include/functions_graph.php
|
||||
operation/netflow/nf_view.php: Graph changes.
|
||||
|
|
|
@ -146,27 +146,29 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
|||
}
|
||||
$current_ts = $last_timestamp;
|
||||
$in_range = true;
|
||||
|
||||
if ($period <= 3600) {
|
||||
$title_period = __('Last hour');
|
||||
$time_format = 'G:i:s';
|
||||
$time_format_2 = '';
|
||||
|
||||
$temp_range = $period;
|
||||
if ($period < $prediction_period)
|
||||
$temp_range = $prediction_period;
|
||||
|
||||
if ($temp_range <= 21600) {
|
||||
$time_format = 'H:i:s';
|
||||
}
|
||||
elseif ($period <= 86400) {
|
||||
$title_period = __('Last day');
|
||||
$time_format = 'G:i';
|
||||
elseif ($temp_range < 86400) {
|
||||
$time_format = 'H:i';
|
||||
}
|
||||
elseif ($period <= 604800) {
|
||||
$title_period = __('Last week');
|
||||
$time_format = 'M j';
|
||||
elseif ($temp_range < 1296000) {
|
||||
$time_format = 'M d';
|
||||
$time_format_2 = 'H\h';
|
||||
}
|
||||
elseif ($period <= 2419200) {
|
||||
$title_period = __('Last month');
|
||||
$time_format = 'M j';
|
||||
elseif ($temp_range <= 2592000) {
|
||||
$time_format = 'M d';
|
||||
$time_format_2 = 'H\h';
|
||||
}
|
||||
else {
|
||||
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2));
|
||||
$time_format = 'M j';
|
||||
}
|
||||
$time_format = 'M d';
|
||||
}
|
||||
|
||||
// Aplying linear regression to module data in order to do the prediction
|
||||
$output_data = array();
|
||||
|
@ -174,6 +176,10 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
|||
// Create data in graph format like
|
||||
while ($in_range){
|
||||
$timestamp_f = date($time_format, $current_ts);
|
||||
|
||||
//$timestamp_f = date($time_format, $current_ts);
|
||||
$timestamp_f = graph_get_formatted_date($current_ts, $time_format, $time_format_2);
|
||||
|
||||
if ($csv){
|
||||
$output_data[$idx]['date'] = $current_ts;
|
||||
$output_data[$idx]['data'] = ($a + ($b * $current_ts));
|
||||
|
|
|
@ -385,24 +385,33 @@ function graph_get_formatted_date($timestamp, $format1, $format2) {
|
|||
*/
|
||||
function graphic_combined_module ($module_list, $weight_list, $period, $width, $height,
|
||||
$title, $unit_name, $show_events = 0, $show_alerts = 0, $pure = 0,
|
||||
$stacked = 0, $date = 0, $only_image = false, $homeurl = '', $ttl = 1, $projection = false) {
|
||||
$stacked = 0, $date = 0, $only_image = false, $homeurl = '', $ttl = 1, $projection = false, $prediction_period = false) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
||||
$time_format_2 = '';
|
||||
$temp_range = $period;
|
||||
|
||||
if ($projection != false){
|
||||
if ($period < $prediction_period)
|
||||
$temp_range = $prediction_period;
|
||||
}
|
||||
|
||||
// Set the title and time format
|
||||
if ($period <= 21600) {
|
||||
if ($temp_range <= 21600) {
|
||||
$time_format = 'H:i:s';
|
||||
}
|
||||
elseif ($period < 86400) {
|
||||
elseif ($temp_range < 86400) {
|
||||
$time_format = 'H:i';
|
||||
}
|
||||
elseif ($period < 1296000) {
|
||||
elseif ($temp_range < 1296000) {
|
||||
$time_format = 'M d';
|
||||
$time_format_2 = 'H:i';
|
||||
if ($projection != false){
|
||||
$time_format_2 = 'H\h';
|
||||
}
|
||||
}
|
||||
elseif ($period <= 2592000) {
|
||||
elseif ($temp_range <= 2592000) {
|
||||
$time_format = 'M d';
|
||||
$time_format_2 = 'H\h';
|
||||
}
|
||||
|
@ -668,13 +677,13 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
|
|||
// Added to support projection graphs
|
||||
if ($projection != false and $i != 0){
|
||||
$projection_data = array();
|
||||
$projection_data = array_merge($before_projection, $projection);
|
||||
$projection_data = array_merge($before_projection, $projection);
|
||||
$graph_values[$i] = $projection_data;
|
||||
}else{
|
||||
$graph_values[$i] = $temp_graph_values;
|
||||
$graph_values[$i] = $temp_graph_values;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Add the max, min and avg in the legend
|
||||
$avg = round($avg / $countAvg, 1);
|
||||
|
||||
|
|
|
@ -2140,7 +2140,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
'',
|
||||
1,
|
||||
// Important parameter, this tell to graphic_combined_module function that is a projection graph
|
||||
$output_projection
|
||||
$output_projection,
|
||||
$content['top_n_value']
|
||||
);
|
||||
array_push ($table->data, $data);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue