Fixed min/max absolute values in charts

This commit is contained in:
fbsanchez 2018-07-12 12:34:05 +02:00
parent 62ed69af90
commit fa4446bb91
1 changed files with 27 additions and 12 deletions

View File

@ -4084,21 +4084,32 @@ function fullscale_data (
$data["sum" . $series_suffix]['data'][] = array($real_date , $sum_data/$count_data); $data["sum" . $series_suffix]['data'][] = array($real_date , $sum_data/$count_data);
if($type_mode_graph && !$params['baseline']){ if($type_mode_graph && !$params['baseline']){
if($min_value != PHP_INT_MAX) {
$data["min" . $series_suffix]['data'][] = array($real_date , $min_value); $data["min" . $series_suffix]['data'][] = array($real_date , $min_value);
}
if($max_value != -PHP_INT_MAX) {
$data["max" . $series_suffix]['data'][] = array($real_date , $max_value); $data["max" . $series_suffix]['data'][] = array($real_date , $max_value);
} }
}
else{ else{
if($min_value != PHP_INT_MAX) {
$data["sum" . $series_suffix]['slice_data'][$real_date]['min'] = $min_value; $data["sum" . $series_suffix]['slice_data'][$real_date]['min'] = $min_value;
}
$data["sum" . $series_suffix]['slice_data'][$real_date]['avg'] = $sum_data/$count_data; $data["sum" . $series_suffix]['slice_data'][$real_date]['avg'] = $sum_data/$count_data;
if($max_value != -PHP_INT_MAX) {
$data["sum" . $series_suffix]['slice_data'][$real_date]['max'] = $max_value; $data["sum" . $series_suffix]['slice_data'][$real_date]['max'] = $max_value;
} }
}
//max_total //max_total
if($max_value >= $max_value_total){ if($max_value >= $max_value_total && $max_value != -PHP_INT_MAX){
$max_value_total = $max_value; $max_value_total = $max_value;
} }
//min_total //min_total
if($min_value <= $min_value_total){ if($min_value <= $min_value_total && $min_value != PHP_INT_MAX){
$min_value_total = $min_value; $min_value_total = $min_value;
} }
//avg sum_total //avg sum_total
@ -4110,27 +4121,31 @@ function fullscale_data (
if($type_mode_graph && !$params['baseline']){ if($type_mode_graph && !$params['baseline']){
/*MIN*/ /*MIN*/
//max_min //max_min
if($min_value >= $min_value_max){ if($min_value >= $min_value_max && $min_value != PHP_INT_MAX){
$min_value_max = $min_value; $min_value_max = $min_value;
} }
//min_min //min_min
if($min_value <= $min_value_min){ if($min_value <= $min_value_min && $min_value != PHP_INT_MAX){
$min_value_min = $min_value; $min_value_min = $min_value;
} }
//avg sum_min //avg sum_min
if ($min_value != PHP_INT_MAX) {
$sum_data_min += $min_value; $sum_data_min += $min_value;
}
/*MAX*/ /*MAX*/
//max_max //max_max
if($max_value >= $max_value_max){ if($max_value >= $max_value_max && $max_value != -PHP_INT_MAX){
$max_value_max = $max_value; $max_value_max = $max_value;
} }
//min_max //min_max
if($max_value <= $max_value_min){ if($max_value <= $max_value_min && $max_value != -PHP_INT_MAX){
$max_value_min = $max_value; $max_value_min = $max_value;
} }
//avg sum_max //avg sum_max
if ($max_value != -PHP_INT_MAX) {
$sum_data_max += $max_value; $sum_data_max += $max_value;
}
/*AVG*/ /*AVG*/
//max_max //max_max