Correct a JavaScript exception for empty distributions
If you create a distribution but don't write to it, the mean of the distribution is NaN - which Aeson encodes as `null`. Thus we have to make sure that when working with the mean, we check for `null`.
This commit is contained in:
parent
9a6e426075
commit
e2fee86469
1 changed files with 7 additions and 2 deletions
|
@ -293,8 +293,13 @@ $(document).ready(function () {
|
|||
}
|
||||
if (!paused) {
|
||||
if (value.type === DISTRIBUTION) {
|
||||
if (value.mean !== null) {
|
||||
var val = value.mean.toPrecision(8) + '\n+/-' +
|
||||
Math.sqrt(value.variance).toPrecision(8) + ' sd';
|
||||
}
|
||||
else {
|
||||
var val = "N/A";
|
||||
}
|
||||
} else { // COUNTER, GAUGE, LABEL
|
||||
var val = value.val;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue