From a70243d9e9a7bf301b0453d5e9a411593327ca36 Mon Sep 17 00:00:00 2001 From: yamakatu Date: Fri, 29 Nov 2013 22:58:54 +0900 Subject: [PATCH] add no zero filling option to histogram --- src/app/panels/histogram/timeSeries.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/app/panels/histogram/timeSeries.js b/src/app/panels/histogram/timeSeries.js index 8885e734371..f2558dc9108 100644 --- a/src/app/panels/histogram/timeSeries.js +++ b/src/app/panels/histogram/timeSeries.js @@ -101,6 +101,8 @@ function (_, Interval) { strategy = this._getAllFlotPairs; } else if(this.opts.fill_style === 'null') { strategy = this._getNullFlotPairs; + } else if(this.opts.fill_style === 'no') { + strategy = this._getiNoZeroFlotPairs; } else { strategy = this._getMinFlotPairs; } @@ -211,6 +213,19 @@ function (_, Interval) { return result; }; + /** + * ** called as a reduce stragegy in getFlotPairs() ** + * Not fill zero's on either side of the current time, only the current time + * @return {array} An array of points to plot with flot + */ + ts.ZeroFilled.prototype._getiNoZeroFlotPairs = function (result, time, i, times) { + var next, expected_next, prev, expected_prev; + // add the current time + result.push([ time, this._data[time] || 0 ]); + + return result; + }; + return ts; }); \ No newline at end of file