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

(cherry picked from commit b8a0a542f2)
This commit is contained in:
m-lopez-f 2016-11-15 10:55:41 +01:00
parent 6c65f4ab12
commit 0b5d8831df
3 changed files with 18 additions and 13 deletions

View File

@ -340,15 +340,17 @@ switch ($action) {
break; break;
} }
$returnValue_value = explode(' ', $returnValue); //~ $returnValue_value = explode(' ', $returnValue);
$return = array(); $return = array();
if ($returnValue_value[1] != "") { 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 { 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['max_percentile'] = $layoutData['height'];
$return['width_percentile'] = $layoutData['width']; $return['width_percentile'] = $layoutData['width'];
$return['unit_text'] = $unit_text; $return['unit_text'] = $unit_text;

View File

@ -244,7 +244,7 @@ function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands
$number = $number / 1000; $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) { function human_milliseconds_to_string($seconds) {

View File

@ -1013,19 +1013,20 @@ function visual_map_print_item($mode = "read", $layoutData,
global $config; global $config;
if ($type == SIMPLE_VALUE) { 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 { else {
// If the value is a string, dont format it // If the value is a string, dont format it
if (!is_string($value)) { 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 * @return string value retrieved with units
*/ */
function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY) { function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY) {
global $config;
$unit_text = db_get_sql ('SELECT unit $unit_text = db_get_sql ('SELECT unit
FROM tagente_modulo WHERE id_agente_modulo = ' . $id_module); FROM tagente_modulo WHERE id_agente_modulo = ' . $id_module);
$unit_text = trim(io_safe_output($unit_text)); $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 { else {
if ( is_numeric($value) ) if ( is_numeric($value) )
$value = format_for_graph($value, 2); $value = format_for_graph($value, $config['graph_precision']);
if (!empty($unit_text)) { if (!empty($unit_text)) {
$value .= " " . $unit_text; $value .= " " . $unit_text;
} }