1export class AxesEditorCtrl {
2  panel: any;
3  panelCtrl: any;
4  logScales: any;
5  dataFormats: any;
6  yBucketBoundModes: any;
7
8  /** @ngInject */
9  constructor($scope: any, uiSegmentSrv: any) {
10    $scope.editor = this;
11    this.panelCtrl = $scope.ctrl;
12    this.panel = this.panelCtrl.panel;
13
14    this.logScales = {
15      linear: 1,
16      'log (base 2)': 2,
17      'log (base 10)': 10,
18      'log (base 32)': 32,
19      'log (base 1024)': 1024,
20    };
21
22    this.dataFormats = {
23      'Time series': 'timeseries',
24      'Time series buckets': 'tsbuckets',
25    };
26
27    this.yBucketBoundModes = {
28      Auto: 'auto',
29      Upper: 'upper',
30      Lower: 'lower',
31      Middle: 'middle',
32    };
33  }
34
35  setUnitFormat = (unit: string) => {
36    this.panel.yAxis.format = unit;
37    this.panelCtrl.render();
38  };
39}
40
41/** @ngInject */
42export function axesEditor() {
43  'use strict';
44  return {
45    restrict: 'E',
46    scope: true,
47    templateUrl: 'public/app/plugins/panel/heatmap/partials/axes_editor.html',
48    controller: AxesEditorCtrl,
49  };
50}
51