fixed errors in simple graphs value negative

This commit is contained in:
daniel 2017-08-29 09:28:05 +02:00
parent 8616015f38
commit 487711d567
2 changed files with 19 additions and 1 deletions

View File

@ -1667,6 +1667,15 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
how_bigger = "K"; how_bigger = "K";
y = y / 1000; y = y / 1000;
} }
else if(y < -1000000) {
how_bigger = "M";
y = y / 1000000;
}
else if (y < -1000) {
console.log('entra por negativo');
how_bigger = "K";
y = y / 1000;
}
if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) { if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) {
$('#timestamp_'+graph_id).show(); $('#timestamp_'+graph_id).show();
@ -2090,6 +2099,10 @@ function number_format(number, force_integer, unit) {
pos++; //Position in array starting with 0 pos++; //Position in array starting with 0
number = number / 1000; number = number / 1000;
} }
else if (number <= -1000) {
pos++;
number = number / 1000;
}
else { else {
break; break;
} }

View File

@ -981,7 +981,8 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
($height - $margin_bottom)); ($height - $margin_bottom));
/*Get minimun value to draw axis properly*/ /*Get minimun value to draw axis properly*/
$min_data = min($data['min']);
$min_data = min(min($data));
$ManualScale = array(); $ManualScale = array();
$mode = SCALE_MODE_START0; $mode = SCALE_MODE_START0;
if ($min_data < 0) { if ($min_data < 0) {
@ -992,6 +993,10 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$ManualScale = array(0 => array("Min" => $min_data, "Max" => 0)); $ManualScale = array(0 => array("Min" => $min_data, "Max" => 0));
$mode = SCALE_MODE_MANUAL; $mode = SCALE_MODE_MANUAL;
} }
else if ($max_data >= 0 && $min_data <= 0){
$ManualScale = array(0 => array("Min" => $min_data, "Max" => $max_data));
$mode = SCALE_MODE_MANUAL;
}
if($graph_threshold){ if($graph_threshold){
$sql_treshold = 'select min_critical, max_critical, min_warning, max_warning, critical_inverse, warning_inverse from tagente_modulo where id_agente_modulo =' . $id_module; $sql_treshold = 'select min_critical, max_critical, min_warning, max_warning, critical_inverse, warning_inverse from tagente_modulo where id_agente_modulo =' . $id_module;