axes_editor.ts 1.1 KB

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