added rounding to the wfm sidebar to make sure numbers arent too long

This commit is contained in:
2016-04-01 14:00:14 +02:00
parent 5376f1ba7b
commit b091727ddd
7 changed files with 19 additions and 11 deletions
+3 -3
View File
@@ -33,9 +33,9 @@ var page_waveform = (function () {
// Sidebar
$('#stat-count').html(j.stats.count);
$('#stat-f-s').html(j.stats.freq);
$('#stat-i-peak').html(peak);
$('#stat-i-rms').html(j.stats.rms);
$('#stat-f-s').html(numfmt(j.stats.freq, 2));
$('#stat-i-peak').html(numfmt(peak, 2));
$('#stat-i-rms').html(numfmt(j.stats.rms, 2));
$('.stats').removeClass('invis');
// --- chart ---
+5
View File
@@ -2,6 +2,11 @@ function bool(x) {
return (x === 1 || x === '1' || x === true || x === 'true');
}
function numfmt(x, places) {
var pow = Math.pow(10, places);
return Math.round(x*pow) / pow;
}
/**
* Perform a substitution in the given string.
*