From 0fd96b951ae2b8fda8bedd1df05cf4477f548bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 2 May 2017 09:55:18 +0200 Subject: [PATCH 1/3] wip: heatmap refactor --- .../app/plugins/panel/heatmap/axes_editor.ts | 25 +++++++- .../app/plugins/panel/heatmap/heatmap_ctrl.ts | 8 +-- public/app/plugins/panel/heatmap/module.html | 1 - .../panel/heatmap/partials/axes_editor.html | 58 ++++++------------- 4 files changed, 44 insertions(+), 48 deletions(-) diff --git a/public/app/plugins/panel/heatmap/axes_editor.ts b/public/app/plugins/panel/heatmap/axes_editor.ts index b8fcba871a7..2bf4ac05622 100644 --- a/public/app/plugins/panel/heatmap/axes_editor.ts +++ b/public/app/plugins/panel/heatmap/axes_editor.ts @@ -8,13 +8,14 @@ export class AxesEditorCtrl { unitFormats: any; logScales: any; dataFormats: any; + yBucketOptions: any[]; + xBucketOptions: any[]; /** @ngInject */ - constructor($scope) { + constructor($scope, uiSegmentSrv) { $scope.editor = this; this.panelCtrl = $scope.ctrl; this.panel = this.panelCtrl.panel; - this.unitFormats = kbn.getUnitFormats(); this.logScales = { @@ -29,6 +30,26 @@ export class AxesEditorCtrl { 'Time series': 'timeseries', 'Time series Pre-bucketed': 'tsbuckets' }; + + this.yBucketOptions = [ + {text: '5', value: '5'}, + {text: '10', value: '10'}, + {text: '20', value: '20'}, + {text: '30', value: '30'}, + {text: '50', value: '50'}, + ]; + + this.xBucketOptions = [ + {text: '15', value: '15'}, + {text: '20', value: '20'}, + {text: '30', value: '30'}, + {text: '50', value: '50'}, + {text: '1m', value: '1m'}, + {text: '5m', value: '5m'}, + {text: '10m', value: '10m'}, + {text: '20m', value: '20m'}, + {text: '1h', value: '1h'}, + ]; } setUnitFormat(subItem) { diff --git a/public/app/plugins/panel/heatmap/heatmap_ctrl.ts b/public/app/plugins/panel/heatmap/heatmap_ctrl.ts index c0d3a7bd25d..8a7672f7a23 100644 --- a/public/app/plugins/panel/heatmap/heatmap_ctrl.ts +++ b/public/app/plugins/panel/heatmap/heatmap_ctrl.ts @@ -28,12 +28,9 @@ let panelDefaults = { fillBackground: false }, dataFormat: 'timeseries', - xBucketSize: null, - xBucketNumber: null, - yBucketSize: null, - yBucketNumber: null, xAxis: { - show: true + show: true, + buckets: 'auto', }, yAxis: { show: true, @@ -43,6 +40,7 @@ let panelDefaults = { splitFactor: null, min: null, max: null, + buckets: 'auto', removeZeroValues: false }, tooltip: { diff --git a/public/app/plugins/panel/heatmap/module.html b/public/app/plugins/panel/heatmap/module.html index a59092b2687..6cb89f2e1f2 100644 --- a/public/app/plugins/panel/heatmap/module.html +++ b/public/app/plugins/panel/heatmap/module.html @@ -7,6 +7,5 @@
-
diff --git a/public/app/plugins/panel/heatmap/partials/axes_editor.html b/public/app/plugins/panel/heatmap/partials/axes_editor.html index 161be2dab19..a8dd1a05473 100644 --- a/public/app/plugins/panel/heatmap/partials/axes_editor.html +++ b/public/app/plugins/panel/heatmap/partials/axes_editor.html @@ -1,12 +1,8 @@
Y Axis
- -
- +
- +
-
- - +
+ +
-
- - +
+ +
- +
-
- - -
-
- - +
+
+ + +
- +
- -
X Axis
- -
- +
-
- - -
From 61b51c0cbf09834a22ca0f228ecb0443b1e3d513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 4 May 2017 16:03:47 +0200 Subject: [PATCH 2/3] heatmap: refactoring --- .../app/plugins/panel/heatmap/axes_editor.ts | 24 +++---------- .../panel/heatmap/partials/axes_editor.html | 36 +++++++++++-------- 2 files changed, 25 insertions(+), 35 deletions(-) diff --git a/public/app/plugins/panel/heatmap/axes_editor.ts b/public/app/plugins/panel/heatmap/axes_editor.ts index 2bf4ac05622..32ea66cc4d9 100644 --- a/public/app/plugins/panel/heatmap/axes_editor.ts +++ b/public/app/plugins/panel/heatmap/axes_editor.ts @@ -8,8 +8,7 @@ export class AxesEditorCtrl { unitFormats: any; logScales: any; dataFormats: any; - yBucketOptions: any[]; - xBucketOptions: any[]; + yBucketModes: any[]; /** @ngInject */ constructor($scope, uiSegmentSrv) { @@ -31,24 +30,9 @@ export class AxesEditorCtrl { 'Time series Pre-bucketed': 'tsbuckets' }; - this.yBucketOptions = [ - {text: '5', value: '5'}, - {text: '10', value: '10'}, - {text: '20', value: '20'}, - {text: '30', value: '30'}, - {text: '50', value: '50'}, - ]; - - this.xBucketOptions = [ - {text: '15', value: '15'}, - {text: '20', value: '20'}, - {text: '30', value: '30'}, - {text: '50', value: '50'}, - {text: '1m', value: '1m'}, - {text: '5m', value: '5m'}, - {text: '10m', value: '10m'}, - {text: '20m', value: '20m'}, - {text: '1h', value: '1h'}, + this.yBucketModes = [ + {text: 'Count', value: 'count'}, + {text: 'Interval', value: 'interval'}, ]; } diff --git a/public/app/plugins/panel/heatmap/partials/axes_editor.html b/public/app/plugins/panel/heatmap/partials/axes_editor.html index a8dd1a05473..933f3f08df1 100644 --- a/public/app/plugins/panel/heatmap/partials/axes_editor.html +++ b/public/app/plugins/panel/heatmap/partials/axes_editor.html @@ -3,7 +3,7 @@
Y Axis
-
@@ -11,19 +11,17 @@
-
+
-
-
- - -
-
- - -
+
+ + +
+
+ +
@@ -34,10 +32,18 @@
- - + +
+ +
+ + + Number of buckets for Y axis
From 5acabc6ccbfab78b7441e2894e0ba7513025ac29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 4 May 2017 19:56:20 +0200 Subject: [PATCH 3/3] heatmap: refactoring --- .../app/plugins/panel/heatmap/axes_editor.ts | 6 -- .../app/plugins/panel/heatmap/heatmap_ctrl.ts | 12 ++- .../panel/heatmap/partials/axes_editor.html | 84 +++++++++++-------- 3 files changed, 58 insertions(+), 44 deletions(-) diff --git a/public/app/plugins/panel/heatmap/axes_editor.ts b/public/app/plugins/panel/heatmap/axes_editor.ts index 32ea66cc4d9..46926697522 100644 --- a/public/app/plugins/panel/heatmap/axes_editor.ts +++ b/public/app/plugins/panel/heatmap/axes_editor.ts @@ -8,7 +8,6 @@ export class AxesEditorCtrl { unitFormats: any; logScales: any; dataFormats: any; - yBucketModes: any[]; /** @ngInject */ constructor($scope, uiSegmentSrv) { @@ -29,11 +28,6 @@ export class AxesEditorCtrl { 'Time series': 'timeseries', 'Time series Pre-bucketed': 'tsbuckets' }; - - this.yBucketModes = [ - {text: 'Count', value: 'count'}, - {text: 'Interval', value: 'interval'}, - ]; } setUnitFormat(subItem) { diff --git a/public/app/plugins/panel/heatmap/heatmap_ctrl.ts b/public/app/plugins/panel/heatmap/heatmap_ctrl.ts index 8a7672f7a23..5c5f8b33efb 100644 --- a/public/app/plugins/panel/heatmap/heatmap_ctrl.ts +++ b/public/app/plugins/panel/heatmap/heatmap_ctrl.ts @@ -30,7 +30,11 @@ let panelDefaults = { dataFormat: 'timeseries', xAxis: { show: true, - buckets: 'auto', + buckets: { + mode: 'count', + count: null, + size: null, + }, }, yAxis: { show: true, @@ -40,7 +44,11 @@ let panelDefaults = { splitFactor: null, min: null, max: null, - buckets: 'auto', + buckets: { + mode: 'count', + count: null, + size: null, + }, removeZeroValues: false }, tooltip: { diff --git a/public/app/plugins/panel/heatmap/partials/axes_editor.html b/public/app/plugins/panel/heatmap/partials/axes_editor.html index 933f3f08df1..5841470f69c 100644 --- a/public/app/plugins/panel/heatmap/partials/axes_editor.html +++ b/public/app/plugins/panel/heatmap/partials/axes_editor.html @@ -4,9 +4,9 @@
+ ng-model="ctrl.panel.yAxis.format" + dropdown-typeahead2="editor.unitFormats" + dropdown-typeahead-on-select="editor.setUnitFormat($subItem)">
@@ -26,54 +26,66 @@
+ bs-tooltip="'Override automatic decimal precision for axis.'" + ng-model="ctrl.panel.yAxis.decimals" ng-change="ctrl.render()" ng-model-onblur>
+
+ +
+
Buckets
- -
- -
- - - Number of buckets for Y axis + + + +
+
+ + +
+
+
+
+ + + +
+
+ +
- - + + +
-
X Axis
+
Data format
- - -
-
- -
-
Data format
-
- -
- + +
+ +
-