Fixed problems with data in visual console. Ticket: #4181

This commit is contained in:
m-lopez-f 2016-11-15 10:55:41 +01:00
parent d34e0db5ec
commit b8a0a542f2
3 changed files with 18 additions and 13 deletions

View File

@ -340,15 +340,17 @@ switch ($action) {
break;
}
$returnValue_value = explode(' ', $returnValue);
//~ $returnValue_value = explode(' ', $returnValue);
$return = array();
if ($returnValue_value[1] != "") {
$return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
//~ $return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
}
else {
$return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
//~ $return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
}
$return['value'] = $returnValue;
$return['max_percentile'] = $layoutData['height'];
$return['width_percentile'] = $layoutData['width'];
$return['unit_text'] = $unit_text;

View File

@ -244,7 +244,7 @@ function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands
$number = $number / 1000;
}
return format_numeric ($number, $decimals). $shorts[$pos]; //This will actually do the rounding and the decimals
return remove_right_zeros(format_numeric ($number, $decimals)). $shorts[$pos]; //This will actually do the rounding and the decimals
}
function human_milliseconds_to_string($seconds) {

View File

@ -1013,19 +1013,20 @@ function visual_map_print_item($mode = "read", $layoutData,
global $config;
if ($type == SIMPLE_VALUE) {
$returnValue_value = explode(' ', $value);
//~ $returnValue_value = explode(' ', $value);
//~ if ($returnValue_value[1] != "") {
//~ $value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
//~ }
//~ else {
//~ $value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
//~ }
if ($returnValue_value[1] != "") {
$value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
}
else {
$value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
}
}
else {
// If the value is a string, dont format it
if (!is_string($value)) {
$value = remove_right_zeros(format_for_graph($value, $config['graph_precision']));
//~ $value = remove_right_zeros(format_for_graph($value, $config['graph_precision']));
}
}
@ -1144,6 +1145,8 @@ function visual_map_get_simple_value_type($process_simple_value) {
* @return string value retrieved with units
*/
function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY) {
global $config;
$unit_text = db_get_sql ('SELECT unit
FROM tagente_modulo WHERE id_agente_modulo = ' . $id_module);
$unit_text = trim(io_safe_output($unit_text));
@ -1157,7 +1160,7 @@ function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY)
}
else {
if ( is_numeric($value) )
$value = format_for_graph($value, 2);
$value = format_for_graph($value, $config['graph_precision']);
if (!empty($unit_text)) {
$value .= " " . $unit_text;
}