Graph: Fix to legend value Max and negative values, Fixes #1136

This commit is contained in:
Torkel Ödegaard 2014-11-26 09:34:21 +01:00
parent 62b58d8bb0
commit ed2ca5fced
3 changed files with 11 additions and 2 deletions

View File

@ -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)

View File

@ -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) {

View File

@ -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() {