Now the integer numbers of the Y axis of the realtime graphs are shorter
This commit is contained in:
parent
921a025262
commit
5f732d035b
|
@ -28,6 +28,11 @@
|
|||
return formattedTime;
|
||||
}
|
||||
},
|
||||
yaxis: {
|
||||
tickFormatter: function (value, axis) {
|
||||
return shortNumber(value);
|
||||
}
|
||||
},
|
||||
series: {
|
||||
lines: {
|
||||
lineWidth: 2,
|
||||
|
@ -158,6 +163,22 @@
|
|||
});
|
||||
}
|
||||
|
||||
function shortNumber (number) {
|
||||
if (Math.round(number) != number) return number;
|
||||
number = Number.parseInt(number);
|
||||
if (Number.isNaN(number)) return number;
|
||||
|
||||
var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
|
||||
var pos = 0;
|
||||
|
||||
while (number >= 1000 || number <= -1000) {
|
||||
pos++;
|
||||
number = number / 1000;
|
||||
}
|
||||
|
||||
return number + " " + shorts[pos];
|
||||
}
|
||||
|
||||
$('#graph').change(function() {
|
||||
$('form#realgraph').submit();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue