From 8454a9511344f53be0855a5f6597afe9c8c37579 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Thu, 24 Oct 2013 15:48:51 -0700 Subject: [PATCH] Added disabling of counts, configurable min/max, and display of query in legend --- src/app/components/underscore.extended.js | 4 ++ src/app/panels/histogram/module.html | 6 +- src/app/panels/histogram/module.js | 72 +++++++++++++---------- src/app/panels/histogram/styleEditor.html | 28 ++++++++- src/app/services/fields.js | 1 - 5 files changed, 75 insertions(+), 36 deletions(-) diff --git a/src/app/components/underscore.extended.js b/src/app/components/underscore.extended.js index 79369d93fc5..00d80efbd89 100755 --- a/src/app/components/underscore.extended.js +++ b/src/app/components/underscore.extended.js @@ -18,6 +18,10 @@ function () { array.splice(index, 1); return array; }, + // If variable is value, then return alt. If variable is anything else, return value; + toggle: function (variable, value, alt) { + return variable === value ? alt : value; + }, toggleInOut: function(array,value) { if(_.contains(array,value)) { array = _.without(array,value); diff --git a/src/app/panels/histogram/module.html b/src/app/panels/histogram/module.html index b6d74515c6d..81a49717408 100755 --- a/src/app/panels/histogram/module.html +++ b/src/app/panels/histogram/module.html @@ -45,7 +45,11 @@ - {{series.info.alias}} ({{series.hits}}) + + {{series.info.alias || series.info.query}} + {{series.info.alias}} + ({{series.hits}}) + change in {{panel.value_field}} {{panel.mode}} per {{panel.interval}} | ({{hits}} hits) diff --git a/src/app/panels/histogram/module.js b/src/app/panels/histogram/module.js index ca12087308c..866bd22e568 100755 --- a/src/app/panels/histogram/module.js +++ b/src/app/panels/histogram/module.js @@ -78,42 +78,52 @@ function (angular, app, $, _, kbn, moment, timeSeries) { // Set and populate defaults var _d = { - mode : 'count', - time_field : '@timestamp', - queries : { - mode : 'all', - ids : [] + mode : 'count', + time_field : '@timestamp', + queries : { + mode : 'all', + ids : [] }, - value_field : null, - auto_int : true, - resolution : 100, - interval : '5m', - intervals : ['auto','1s','1m','5m','10m','30m','1h','3h','12h','1d','1w','1M','1y'], - fill : 0, - linewidth : 3, - timezone : 'browser', // browser, utc or a standard timezone - spyable : true, - zoomlinks : true, - bars : true, - stack : true, - points : false, - lines : false, - legend : true, - 'x-axis' : true, - 'y-axis' : true, - percentage : false, - zerofill : true, - interactive : true, - options : true, - derivative : false, - scale : 1, - tooltip : { + value_field : null, + auto_int : true, + resolution : 100, + interval : '5m', + intervals : ['auto','1s','1m','5m','10m','30m','1h','3h','12h','1d','1w','1M','1y'], + fill : 0, + linewidth : 3, + timezone : 'browser', // browser, utc or a standard timezone + spyable : true, + zoomlinks : true, + bars : true, + stack : true, + points : false, + lines : false, + legend : true, + show_query : true, + legend_counts : true, + 'x-axis' : true, + 'y-axis' : true, + percentage : false, + zerofill : true, + interactive : true, + options : true, + derivative : false, + scale : 1, + tooltip : { value_type: 'cumulative', query_as_alias: true + }, + grid : { + max: null, + min: 0 } }; _.defaults($scope.panel,_d); + _.defaults($scope.panel.tooltip,_d.tooltip); + _.defaults($scope.panel.grid,_d.grid); + + $scope.init = function() { // Hide view options by default @@ -433,8 +443,8 @@ function (angular, app, $, _, kbn, moment, timeSeries) { }, yaxis: { show: scope.panel['y-axis'], - min: 0, - max: scope.panel.percentage && scope.panel.stack ? 100 : null, + min: scope.panel.grid.min, + max: scope.panel.percentage && scope.panel.stack ? 100 : scope.panel.grid.max, }, xaxis: { timezone: scope.panel.timezone, diff --git a/src/app/panels/histogram/styleEditor.html b/src/app/panels/histogram/styleEditor.html index 170932d93da..20642d55218 100644 --- a/src/app/panels/histogram/styleEditor.html +++ b/src/app/panels/histogram/styleEditor.html @@ -45,9 +45,6 @@
Header
-
- -
@@ -55,4 +52,29 @@
+
+
Legend
+
+ +
+
+ +
+
+ +
+
+ +
+
Grid
+
+ + +
+
+ + +
+
+ diff --git a/src/app/services/fields.js b/src/app/services/fields.js index 25902819f93..c59278f0b73 100755 --- a/src/app/services/fields.js +++ b/src/app/services/fields.js @@ -21,7 +21,6 @@ function (angular, _, config) { var indices = _.difference(n,_.keys(self.mapping)); // Only get the mapping if there are new indices if(indices.length > 0) { - console.log('getting mapping'); self.map(indices).then(function(result) { self.mapping = _.extend(self.mapping,result); self.list = mapFields(self.mapping);