Display averages as rounded floats.
This commit is contained in:
parent
85e748809f
commit
cc2b41527a
|
@ -272,25 +272,25 @@ class Client {
|
||||||
|
|
||||||
private setStatistics (stats : SequenceStatistics) {
|
private setStatistics (stats : SequenceStatistics) {
|
||||||
if (stats !== null) {
|
if (stats !== null) {
|
||||||
this.set('statsFrameTotalAvg', Math.round(stats.totalFrameAvg).toString());
|
this.set('statsFrameTotalAvg', this.roundDigits(stats.totalFrameAvg, 2).toString());
|
||||||
this.set('statsFrameTotalLast', Math.round(stats.totalFrameLast).toString());
|
this.set('statsFrameTotalLast', Math.round(stats.totalFrameLast).toString());
|
||||||
this.set('statsFrameTotalMargin', Math.round(stats.totalFrameMargin).toString());
|
this.set('statsFrameTotalMargin', Math.round(stats.totalFrameMargin).toString());
|
||||||
|
|
||||||
this.set('statsFPS', ((Math.round(stats.fps * 100.0) / 100.0) as number).toString());
|
this.set('statsFPS', this.roundDigits(stats.fps, 2).toString());
|
||||||
|
|
||||||
this.set('statsFrameLoadAvg', Math.round(stats.loadAvg).toString());
|
this.set('statsFrameLoadAvg', this.roundDigits(stats.loadAvg, 2).toString());
|
||||||
this.set('statsFrameLoadMargin', Math.round(stats.loadMargin).toString());
|
this.set('statsFrameLoadMargin', Math.round(stats.loadMargin).toString());
|
||||||
|
|
||||||
this.set('statsFrameOpenLast', Math.round(stats.openLast).toString());
|
this.set('statsFrameOpenLast', Math.round(stats.openLast).toString());
|
||||||
this.set('statsFrameOpenAvg', Math.round(stats.openAvg).toString());
|
this.set('statsFrameOpenAvg', this.roundDigits(stats.openAvg, 2).toString());
|
||||||
this.set('statsFrameOpenMargin', Math.round(stats.openMargin).toString());
|
this.set('statsFrameOpenMargin', Math.round(stats.openMargin).toString());
|
||||||
|
|
||||||
this.set('statsFrameCloseLast', Math.round(stats.closeLast).toString());
|
this.set('statsFrameCloseLast', Math.round(stats.closeLast).toString());
|
||||||
this.set('statsFrameCloseAvg', Math.round(stats.closeAvg).toString());
|
this.set('statsFrameCloseAvg', this.roundDigits(stats.closeAvg, 2).toString());
|
||||||
this.set('statsFrameCloseMargin', Math.round(stats.closeMargin).toString());
|
this.set('statsFrameCloseMargin', Math.round(stats.closeMargin).toString());
|
||||||
|
|
||||||
this.set('statsExposureLast', Math.round(stats.exposureLast).toString());
|
this.set('statsExposureLast', Math.round(stats.exposureLast).toString());
|
||||||
this.set('statsExposureAvg', Math.round(stats.exposureAvg).toString());
|
this.set('statsExposureAvg', this.roundDigits(stats.exposureAvg, 2).toString());
|
||||||
this.set('statsExposureMargin', Math.round(stats.exposureMargin).toString());
|
this.set('statsExposureMargin', Math.round(stats.exposureMargin).toString());
|
||||||
|
|
||||||
this.set('statsElapsed', Math.round(stats.elapsed).toString());
|
this.set('statsElapsed', Math.round(stats.elapsed).toString());
|
||||||
|
@ -491,6 +491,11 @@ class Client {
|
||||||
.replace('minutes', 'm').replace('minute', 'm')
|
.replace('minutes', 'm').replace('minute', 'm')
|
||||||
.replace('seconds', 's').replace('second', 's');
|
.replace('seconds', 's').replace('second', 's');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private roundDigits (val : number, digits : number) {
|
||||||
|
const mult : number = Math.pow(10.0, digits);
|
||||||
|
return Math.round(val * mult) / mult;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
client = new Client();
|
client = new Client();
|
|
@ -89,4 +89,5 @@ declare class Client {
|
||||||
get(id: string): string;
|
get(id: string): string;
|
||||||
private resetForm;
|
private resetForm;
|
||||||
private shortenHumanize;
|
private shortenHumanize;
|
||||||
|
private roundDigits;
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,20 +225,20 @@ class Client {
|
||||||
}
|
}
|
||||||
setStatistics(stats) {
|
setStatistics(stats) {
|
||||||
if (stats !== null) {
|
if (stats !== null) {
|
||||||
this.set('statsFrameTotalAvg', Math.round(stats.totalFrameAvg).toString());
|
this.set('statsFrameTotalAvg', this.roundDigits(stats.totalFrameAvg, 2).toString());
|
||||||
this.set('statsFrameTotalLast', Math.round(stats.totalFrameLast).toString());
|
this.set('statsFrameTotalLast', Math.round(stats.totalFrameLast).toString());
|
||||||
this.set('statsFrameTotalMargin', Math.round(stats.totalFrameMargin).toString());
|
this.set('statsFrameTotalMargin', Math.round(stats.totalFrameMargin).toString());
|
||||||
this.set('statsFPS', (Math.round(stats.fps * 100.0) / 100.0).toString());
|
this.set('statsFPS', this.roundDigits(stats.fps, 2).toString());
|
||||||
this.set('statsFrameLoadAvg', Math.round(stats.loadAvg).toString());
|
this.set('statsFrameLoadAvg', this.roundDigits(stats.loadAvg, 2).toString());
|
||||||
this.set('statsFrameLoadMargin', Math.round(stats.loadMargin).toString());
|
this.set('statsFrameLoadMargin', Math.round(stats.loadMargin).toString());
|
||||||
this.set('statsFrameOpenLast', Math.round(stats.openLast).toString());
|
this.set('statsFrameOpenLast', Math.round(stats.openLast).toString());
|
||||||
this.set('statsFrameOpenAvg', Math.round(stats.openAvg).toString());
|
this.set('statsFrameOpenAvg', this.roundDigits(stats.openAvg, 2).toString());
|
||||||
this.set('statsFrameOpenMargin', Math.round(stats.openMargin).toString());
|
this.set('statsFrameOpenMargin', Math.round(stats.openMargin).toString());
|
||||||
this.set('statsFrameCloseLast', Math.round(stats.closeLast).toString());
|
this.set('statsFrameCloseLast', Math.round(stats.closeLast).toString());
|
||||||
this.set('statsFrameCloseAvg', Math.round(stats.closeAvg).toString());
|
this.set('statsFrameCloseAvg', this.roundDigits(stats.closeAvg, 2).toString());
|
||||||
this.set('statsFrameCloseMargin', Math.round(stats.closeMargin).toString());
|
this.set('statsFrameCloseMargin', Math.round(stats.closeMargin).toString());
|
||||||
this.set('statsExposureLast', Math.round(stats.exposureLast).toString());
|
this.set('statsExposureLast', Math.round(stats.exposureLast).toString());
|
||||||
this.set('statsExposureAvg', Math.round(stats.exposureAvg).toString());
|
this.set('statsExposureAvg', this.roundDigits(stats.exposureAvg, 2).toString());
|
||||||
this.set('statsExposureMargin', Math.round(stats.exposureMargin).toString());
|
this.set('statsExposureMargin', Math.round(stats.exposureMargin).toString());
|
||||||
this.set('statsElapsed', Math.round(stats.elapsed).toString());
|
this.set('statsElapsed', Math.round(stats.elapsed).toString());
|
||||||
this.set('statsEstimate', Math.round(stats.estimate).toString());
|
this.set('statsEstimate', Math.round(stats.estimate).toString());
|
||||||
|
@ -412,6 +412,10 @@ class Client {
|
||||||
.replace('minutes', 'm').replace('minute', 'm')
|
.replace('minutes', 'm').replace('minute', 'm')
|
||||||
.replace('seconds', 's').replace('second', 's');
|
.replace('seconds', 's').replace('second', 's');
|
||||||
}
|
}
|
||||||
|
roundDigits(val, digits) {
|
||||||
|
const mult = Math.pow(10.0, digits);
|
||||||
|
return Math.round(val * mult) / mult;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
client = new Client();
|
client = new Client();
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue