axes_editor.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ///<reference path="../../../headers/common.d.ts" />
  2. import kbn from 'app/core/utils/kbn';
  3. export class AxesEditorCtrl {
  4. panel: any;
  5. panelCtrl: any;
  6. unitFormats: any;
  7. logScales: any;
  8. dataFormats: any;
  9. yBucketModes: any[];
  10. /** @ngInject */
  11. constructor($scope, uiSegmentSrv) {
  12. $scope.editor = this;
  13. this.panelCtrl = $scope.ctrl;
  14. this.panel = this.panelCtrl.panel;
  15. this.unitFormats = kbn.getUnitFormats();
  16. this.logScales = {
  17. 'linear': 1,
  18. 'log (base 2)': 2,
  19. 'log (base 10)': 10,
  20. 'log (base 32)': 32,
  21. 'log (base 1024)': 1024
  22. };
  23. this.dataFormats = {
  24. 'Time series': 'timeseries',
  25. 'Time series Pre-bucketed': 'tsbuckets'
  26. };
  27. this.yBucketModes = [
  28. {text: 'Count', value: 'count'},
  29. {text: 'Interval', value: 'interval'},
  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. }