diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index cc172f82a3..4fbae9dd55 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -1759,7 +1759,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, $('#timestamp_'+graph_id).show(); // If no legend, the timestamp labels are short and with value if (legend.length == 0) { - $('#timestamp_'+graph_id).text(labels[j] + ' (' + parseFloat(y).toFixed(2) + ')'); + $('#timestamp_'+graph_id).text(labels[j] + ' (' + (short_data ? parseFloat(y).toFixed(2) : parseFloat(y)) + ')'); } else { $('#timestamp_'+graph_id).text(labels_long[j]); @@ -1795,7 +1795,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, // The graphs of points type and unknown graphs will dont be updated if (serie_types[i] != 'points' && series.label != $('#hidden-unknown_text').val()) { $('#legend_' + graph_id + ' .legendLabel') - .eq(i).html(label_aux + '= ' + parseFloat(y).toFixed(precision_graph) + how_bigger + ' ' + unit); + .eq(i).html(label_aux + '= ' + (short_data ? parseFloat(y).toFixed(2) : parseFloat(y)) + how_bigger + ' ' + unit); } $('#legend_' + graph_id + ' .legendLabel') @@ -2170,9 +2170,8 @@ function number_format(number, force_integer, unit) { } } else { - var decimals = 2; - var factor = 10 * decimals; - number = Math.round(number*factor)/factor; + // Round to 2 decimals + number = Math.round(number * 100) / 100; } var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"]; @@ -2186,10 +2185,6 @@ function number_format(number, force_integer, unit) { pos++; number = number / 1000; } - else if (number <= -1000) { - pos++; - number = number / 1000; - } else { break; }