From a70243d9e9a7bf301b0453d5e9a411593327ca36 Mon Sep 17 00:00:00 2001 From: yamakatu Date: Fri, 29 Nov 2013 22:58:54 +0900 Subject: [PATCH 1/5] 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 From 678b96d4f06c1ca0a3d7ccb9d51cdd962baa77f1 Mon Sep 17 00:00:00 2001 From: yamakatu Date: Fri, 29 Nov 2013 23:37:07 +0900 Subject: [PATCH 2/5] change function name --- src/app/panels/histogram/timeSeries.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/panels/histogram/timeSeries.js b/src/app/panels/histogram/timeSeries.js index f2558dc9108..9b7138adbe2 100644 --- a/src/app/panels/histogram/timeSeries.js +++ b/src/app/panels/histogram/timeSeries.js @@ -102,7 +102,7 @@ function (_, Interval) { } else if(this.opts.fill_style === 'null') { strategy = this._getNullFlotPairs; } else if(this.opts.fill_style === 'no') { - strategy = this._getiNoZeroFlotPairs; + strategy = this._getNoZeroFlotPairs; } else { strategy = this._getMinFlotPairs; } @@ -218,7 +218,7 @@ function (_, Interval) { * 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) { + ts.ZeroFilled.prototype._getNoZeroFlotPairs = function (result, time, i, times) { var next, expected_next, prev, expected_prev; // add the current time From 43b844fb79aa46fd0f1a7eee3dc4b5666f3b8684 Mon Sep 17 00:00:00 2001 From: yamakatu Date: Fri, 6 Dec 2013 15:31:21 +0900 Subject: [PATCH 3/5] modify the function so that does not show 0, when two or more lines are drawn. --- src/app/panels/histogram/timeSeries.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/panels/histogram/timeSeries.js b/src/app/panels/histogram/timeSeries.js index 9b7138adbe2..02f5f54e20f 100644 --- a/src/app/panels/histogram/timeSeries.js +++ b/src/app/panels/histogram/timeSeries.js @@ -222,7 +222,9 @@ function (_, Interval) { var next, expected_next, prev, expected_prev; // add the current time - result.push([ time, this._data[time] || 0 ]); + if(this._data[time]){ + result.push([ time, this._data[time]]); + } return result; }; From 4384772d092da0d9355be51e0ba8a04f34967dc7 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Wed, 11 Dec 2013 08:51:45 -0700 Subject: [PATCH 4/5] Fix undefined when batarang is enabled. Fix individual query counters in histogram panel --- src/app/directives/kibanaSimplePanel.js | 18 ++++++++++-------- src/app/panels/histogram/module.html | 6 +++--- src/app/panels/histogram/module.js | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/app/directives/kibanaSimplePanel.js b/src/app/directives/kibanaSimplePanel.js index 6274e8749f9..bb6b44c747c 100644 --- a/src/app/directives/kibanaSimplePanel.js +++ b/src/app/directives/kibanaSimplePanel.js @@ -60,14 +60,16 @@ function (angular, _) { loadController(name); }); - $scope.$watch(attr.panel, function (panel) { - // If the panel attribute is specified, create a new scope. This ruins configuration - // so don't do it with anything that needs to use editor.html - if(!_.isUndefined(panel)) { - $scope = $scope.$new(); - $scope.panel = angular.fromJson(panel); - } - }); + if(attr.panel) { + $scope.$watch(attr.panel, function (panel) { + // If the panel attribute is specified, create a new scope. This ruins configuration + // so don't do it with anything that needs to use editor.html + if(!_.isUndefined(panel)) { + $scope = $scope.$new(); + $scope.panel = angular.fromJson(panel); + } + }); + } } }; }); diff --git a/src/app/panels/histogram/module.html b/src/app/panels/histogram/module.html index f52b408e4cb..3db0048586f 100644 --- a/src/app/panels/histogram/module.html +++ b/src/app/panels/histogram/module.html @@ -44,10 +44,10 @@ Zoom Out |  - + - {{series.alias || series.query}} - {{series.alias}} + {{series.query.alias || series.query.query}} + {{series.query.alias}} ({{series.hits}}) diff --git a/src/app/panels/histogram/module.js b/src/app/panels/histogram/module.js index d2a3551d2bd..d476c95da85 100644 --- a/src/app/panels/histogram/module.js +++ b/src/app/panels/histogram/module.js @@ -425,7 +425,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) { $scope.hits += entry.count; // Entire dataset level hits counter }); - $scope.legend[i] = q; + $scope.legend[i] = {query:q,hits:hits}; data[i] = { info: q, From db34054ca07df2e5d39276e82b6a2cb46f6155d1 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Wed, 11 Dec 2013 09:24:01 -0700 Subject: [PATCH 5/5] Fixed jshinting --- src/app/panels/histogram/timeSeries.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/panels/histogram/timeSeries.js b/src/app/panels/histogram/timeSeries.js index 02f5f54e20f..4b0472c1e73 100644 --- a/src/app/panels/histogram/timeSeries.js +++ b/src/app/panels/histogram/timeSeries.js @@ -218,8 +218,7 @@ function (_, Interval) { * 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; + ts.ZeroFilled.prototype._getNoZeroFlotPairs = function (result, time) { // add the current time if(this._data[time]){ @@ -228,6 +227,6 @@ function (_, Interval) { return result; }; - + return ts; }); \ No newline at end of file