Commit 4eb49749 by Torkel Ödegaard

Graph: change to current legend value handling, if last value is null, current…

Graph: change to current legend value handling, if last value is null, current will pick next to last value, Closes #190
parent 3e2c8988
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment