Graph: Fix to legend value Max and negative values, Fixes #1136
This commit is contained in:
1 parent
62b58d8bb0
commit
ed2ca5fced
3 files changed
+11
-2
No files matched your search
@@ -64,7 +64,7 @@ function (_, kbn) {
|
||||
var result = [];
|
||||
|
||||
this.stats.total = 0;
|
||||
this.stats.max = Number.MIN_VALUE;
|
||||
this.stats.max = -Number.MAX_VALUE;
|
||||
this.stats.min = Number.MAX_VALUE;
|
||||
this.stats.avg = null;
|
||||
this.stats.current = null;
|
||||
@@ -106,7 +106,7 @@ function (_, kbn) {
|
||||
this.stats.timeStep = this.datapoints[1][1] - this.datapoints[0][1];
|
||||
}
|
||||
|
||||
if (this.stats.max === Number.MIN_VALUE) { this.stats.max = null; }
|
||||
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) {
|
||||
|
||||
@@ -35,6 +35,14 @@ define([
|
||||
expect(series.stats.current).to.be(10);
|
||||
});
|
||||
|
||||
it('max value should work for negative values', function() {
|
||||
series = new TimeSeries({
|
||||
datapoints: [[-10,1], [-4, 2]]
|
||||
});
|
||||
series.getFlotPairs('null', yAxisFormats);
|
||||
expect(series.stats.max).to.be(-4);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('series overrides', function() {
|
||||
|
||||
Reference in new issue
Block a user