Added size controller to legend in graphs. Ticket #4114

This commit is contained in:
Arturo Gonzalez 2016-11-15 17:07:49 +01:00
parent f81af8b437
commit 397428c3ee
1 changed files with 11 additions and 1 deletions

View File

@ -1703,6 +1703,16 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
var y = series.data[j][1];
var how_bigger = "";
if (y > 1000000) {
how_bigger = "M";
y = y / 1000000;
}
else if (y > 1000) {
how_bigger = "K";
y = y / 1000;
}
if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) {
$('#timestamp_'+graph_id).show();
// If no legend, the timestamp labels are short and with value
@ -1741,7 +1751,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(2) + ' ' + unit);
.eq(i).html(label_aux + '= ' + parseFloat(y).toFixed(precision_graph) + how_bigger + ' ' + unit);
console.log($('#legend_' + graph_id + ' .legendLabel'));
}