axes_editor.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. };
  31. }
  32. setUnitFormat(subItem) {
  33. this.panel.yAxis.format = subItem.value;
  34. this.panelCtrl.render();
  35. }
  36. }
  37. /** @ngInject */
  38. export function axesEditor() {
  39. 'use strict';
  40. return {
  41. restrict: 'E',
  42. scope: true,
  43. templateUrl: 'public/app/plugins/panel/heatmap/partials/axes_editor.html',
  44. controller: AxesEditorCtrl,
  45. };
  46. }