Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #741. add no zero filling option to histogram #742

Merged
merged 3 commits into from
Dec 11, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/app/panels/histogram/timeSeries.js
Original file line number Diff line number Diff line change
Expand Up @@ -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._getNoZeroFlotPairs;
} else {
strategy = this._getMinFlotPairs;
}
Expand Down Expand Up @@ -211,6 +213,21 @@ 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._getNoZeroFlotPairs = function (result, time, i, times) {
var next, expected_next, prev, expected_prev;

// add the current time
if(this._data[time]){
result.push([ time, this._data[time]]);
}

return result;
};

return ts;
});