mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
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
f6818a7277
commit
c0f59eb1ee
@ -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>
|
2012-01-03 Vanessa Gil <vanessa.gil@artica.es>
|
||||||
* include/functions_graph.php
|
* include/functions_graph.php
|
||||||
operation/netflow/nf_view.php: Graph changes.
|
operation/netflow/nf_view.php: Graph changes.
|
||||||
|
@ -146,26 +146,28 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
|||||||
}
|
}
|
||||||
$current_ts = $last_timestamp;
|
$current_ts = $last_timestamp;
|
||||||
$in_range = true;
|
$in_range = true;
|
||||||
|
$time_format_2 = '';
|
||||||
|
|
||||||
if ($period <= 3600) {
|
$temp_range = $period;
|
||||||
$title_period = __('Last hour');
|
if ($period < $prediction_period)
|
||||||
$time_format = 'G:i:s';
|
$temp_range = $prediction_period;
|
||||||
|
|
||||||
|
if ($temp_range <= 21600) {
|
||||||
|
$time_format = 'H:i:s';
|
||||||
}
|
}
|
||||||
elseif ($period <= 86400) {
|
elseif ($temp_range < 86400) {
|
||||||
$title_period = __('Last day');
|
$time_format = 'H:i';
|
||||||
$time_format = 'G:i';
|
|
||||||
}
|
}
|
||||||
elseif ($period <= 604800) {
|
elseif ($temp_range < 1296000) {
|
||||||
$title_period = __('Last week');
|
$time_format = 'M d';
|
||||||
$time_format = 'M j';
|
$time_format_2 = 'H\h';
|
||||||
}
|
}
|
||||||
elseif ($period <= 2419200) {
|
elseif ($temp_range <= 2592000) {
|
||||||
$title_period = __('Last month');
|
$time_format = 'M d';
|
||||||
$time_format = 'M j';
|
$time_format_2 = 'H\h';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2));
|
$time_format = 'M d';
|
||||||
$time_format = 'M j';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aplying linear regression to module data in order to do the prediction
|
// Aplying linear regression to module data in order to do the prediction
|
||||||
@ -174,6 +176,10 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
|||||||
// Create data in graph format like
|
// Create data in graph format like
|
||||||
while ($in_range){
|
while ($in_range){
|
||||||
$timestamp_f = date($time_format, $current_ts);
|
$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){
|
if ($csv){
|
||||||
$output_data[$idx]['date'] = $current_ts;
|
$output_data[$idx]['date'] = $current_ts;
|
||||||
$output_data[$idx]['data'] = ($a + ($b * $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,
|
function graphic_combined_module ($module_list, $weight_list, $period, $width, $height,
|
||||||
$title, $unit_name, $show_events = 0, $show_alerts = 0, $pure = 0,
|
$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 $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
$time_format_2 = '';
|
$time_format_2 = '';
|
||||||
|
$temp_range = $period;
|
||||||
|
|
||||||
|
if ($projection != false){
|
||||||
|
if ($period < $prediction_period)
|
||||||
|
$temp_range = $prediction_period;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the title and time format
|
// Set the title and time format
|
||||||
if ($period <= 21600) {
|
if ($temp_range <= 21600) {
|
||||||
$time_format = 'H:i:s';
|
$time_format = 'H:i:s';
|
||||||
}
|
}
|
||||||
elseif ($period < 86400) {
|
elseif ($temp_range < 86400) {
|
||||||
$time_format = 'H:i';
|
$time_format = 'H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 1296000) {
|
elseif ($temp_range < 1296000) {
|
||||||
$time_format = 'M d';
|
$time_format = 'M d';
|
||||||
$time_format_2 = 'H:i';
|
$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 = 'M d';
|
||||||
$time_format_2 = 'H\h';
|
$time_format_2 = 'H\h';
|
||||||
}
|
}
|
||||||
|
@ -2140,7 +2140,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||||||
'',
|
'',
|
||||||
1,
|
1,
|
||||||
// Important parameter, this tell to graphic_combined_module function that is a projection graph
|
// 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);
|
array_push ($table->data, $data);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user