mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix NaN handling (#9469)
* graph: fix NaN formatting, #9012 * singlestat: prevent null value coloring, #9012, #8404 * timeseries: add tests for #9012 and move test file to TS
This commit is contained in:
committed by
Torkel Ödegaard
parent
473c47cd1c
commit
3184942aeb
@@ -203,7 +203,7 @@ export default class TimeSeries {
|
||||
if (this.stats.max === -Number.MAX_VALUE) { this.stats.max = null; }
|
||||
if (this.stats.min === Number.MAX_VALUE) { this.stats.min = null; }
|
||||
|
||||
if (result.length) {
|
||||
if (result.length && !this.allIsNull) {
|
||||
this.stats.avg = (this.stats.total / nonNulls);
|
||||
this.stats.current = result[result.length-1][1];
|
||||
if (this.stats.current === null && result.length > 1) {
|
||||
@@ -228,6 +228,9 @@ export default class TimeSeries {
|
||||
}
|
||||
|
||||
formatValue(value) {
|
||||
if (!_.isFinite(value)) {
|
||||
value = null; // Prevent NaN formatting
|
||||
}
|
||||
return this.valueFormater(value, this.decimals, this.scaledDecimals);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user