Просмотр исходного кода

Merge pull request #742 from yamakatu/master

Fix for #741. add no zero filling option to histogram
Rashid Khan 12 лет назад
Родитель
Сommit
e58e917677
1 измененных файлов с 17 добавлено и 0 удалено
  1. 17 0
      src/app/panels/histogram/timeSeries.js

+ 17 - 0
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._getNoZeroFlotPairs;
     } else {
       strategy = this._getMinFlotPairs;
     }
@@ -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;
 });