Commit a532f463 by Ryan McKinley Committed by GitHub

Heatmap: use the standard unit picker component (#26751)

parent df11cdad
import kbn from 'app/core/utils/kbn';
export class AxesEditorCtrl { export class AxesEditorCtrl {
panel: any; panel: any;
panelCtrl: any; panelCtrl: any;
unitFormats: any;
logScales: any; logScales: any;
dataFormats: any; dataFormats: any;
yBucketBoundModes: any; yBucketBoundModes: any;
...@@ -12,7 +10,6 @@ export class AxesEditorCtrl { ...@@ -12,7 +10,6 @@ export class AxesEditorCtrl {
$scope.editor = this; $scope.editor = this;
this.panelCtrl = $scope.ctrl; this.panelCtrl = $scope.ctrl;
this.panel = this.panelCtrl.panel; this.panel = this.panelCtrl.panel;
this.unitFormats = kbn.getUnitFormats();
this.logScales = { this.logScales = {
linear: 1, linear: 1,
...@@ -35,10 +32,10 @@ export class AxesEditorCtrl { ...@@ -35,10 +32,10 @@ export class AxesEditorCtrl {
}; };
} }
setUnitFormat(subItem: any) { setUnitFormat = (unit: string) => {
this.panel.yAxis.format = subItem.value; this.panel.yAxis.format = unit;
this.panelCtrl.render(); this.panelCtrl.render();
} };
} }
/** @ngInject */ /** @ngInject */
......
...@@ -3,11 +3,7 @@ ...@@ -3,11 +3,7 @@
<h5 class="section-heading">Y Axis</h5> <h5 class="section-heading">Y Axis</h5>
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label width-8">Unit</label> <label class="gf-form-label width-8">Unit</label>
<div class="gf-form-dropdown-typeahead width-12" <unit-picker onChange="editor.setUnitFormat" value="ctrl.panel.yAxis.format" class="width-12"></unit-picker>
ng-model="ctrl.panel.yAxis.format"
dropdown-typeahead2="editor.unitFormats"
dropdown-typeahead-on-select="editor.setUnitFormat($subItem)">
</div>
</div> </div>
<div ng-if="ctrl.panel.dataFormat == 'timeseries'"> <div ng-if="ctrl.panel.dataFormat == 'timeseries'">
<div class="gf-form"> <div class="gf-form">
...@@ -51,7 +47,7 @@ ...@@ -51,7 +47,7 @@
<h5 class="section-heading">Buckets</h5> <h5 class="section-heading">Buckets</h5>
<div class="gf-form-inline"> <div class="gf-form-inline">
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label width-5">Y Axis</label> <label class="gf-form-label width-4">Y Axis</label>
</div> </div>
<div class="gf-form" ng-show="ctrl.panel.yAxis.logBase === 1"> <div class="gf-form" ng-show="ctrl.panel.yAxis.logBase === 1">
<label class="gf-form-label width-5">Buckets</label> <label class="gf-form-label width-5">Buckets</label>
...@@ -78,7 +74,7 @@ ...@@ -78,7 +74,7 @@
</div> </div>
<div class="gf-form-inline"> <div class="gf-form-inline">
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label width-5">X Axis</label> <label class="gf-form-label width-4">X Axis</label>
</div> </div>
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label width-5">Buckets</label> <label class="gf-form-label width-5">Buckets</label>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment