mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Graph: change to current legend value handling, if last value is null, current will pick next to last value, Closes #190
This commit is contained in:
parent
3e2c898881
commit
4eb4974909
@ -112,6 +112,9 @@ function (_, kbn) {
|
||||
if (result.length) {
|
||||
this.stats.avg = (this.stats.total / result.length);
|
||||
this.stats.current = result[result.length-1][1];
|
||||
if (this.stats.current === null && result.length > 1) {
|
||||
this.stats.current = result[result.length-2][1];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -26,6 +26,15 @@ define([
|
||||
expect(points.length).to.be(4);
|
||||
expect(points[1][1]).to.be(0);
|
||||
});
|
||||
|
||||
it('if last is null current should pick next to last', function() {
|
||||
series = new TimeSeries({
|
||||
datapoints: [[10,1], [null, 2]]
|
||||
});
|
||||
series.getFlotPairs('null', yAxisFormats);
|
||||
expect(series.stats.current).to.be(10);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('series overrides', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user