axes_editor.ts 1.0 KB

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