diff --git a/CHANGELOG.md b/CHANGELOG.md index f785ad5a0a6..00daadbdffa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - [Issue #1087](https://github.com/grafana/grafana/issues/1087). Panel: Fixed IE9 crash due to angular drag drop - [Issue #1093](https://github.com/grafana/grafana/issues/1093). SingleStatPanel: Fixed position for drilldown link tooltip when dashboard requires scrolling - [Issue #1095](https://github.com/grafana/grafana/issues/1095). DrilldownLink: template variables in params property was not interpolated +- [Issue #1136](https://github.com/grafana/grafana/issues/1136). Graph: Fix to legend value Max and negative values # 1.9.0-rc1 (2014-11-17) diff --git a/src/app/components/timeSeries.js b/src/app/components/timeSeries.js index f9329141640..fd7b9fe849a 100644 --- a/src/app/components/timeSeries.js +++ b/src/app/components/timeSeries.js @@ -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) { diff --git a/src/test/specs/timeSeries-specs.js b/src/test/specs/timeSeries-specs.js index e68ce16d54e..66d761ab193 100644 --- a/src/test/specs/timeSeries-specs.js +++ b/src/test/specs/timeSeries-specs.js @@ -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() {