axes_editor.ts 971 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. /** @ngInject */
  9. constructor($scope, uiSegmentSrv) {
  10. $scope.editor = this;
  11. this.panelCtrl = $scope.ctrl;
  12. this.panel = this.panelCtrl.panel;
  13. this.unitFormats = kbn.getUnitFormats();
  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. this.dataFormats = {
  22. 'Time series': 'timeseries',
  23. 'Time series buckets': 'tsbuckets',
  24. };
  25. }
  26. setUnitFormat(subItem) {
  27. this.panel.yAxis.format = subItem.value;
  28. this.panelCtrl.render();
  29. }
  30. }
  31. /** @ngInject */
  32. export function axesEditor() {
  33. 'use strict';
  34. return {
  35. restrict: 'E',
  36. scope: true,
  37. templateUrl: 'public/app/plugins/panel/heatmap/partials/axes_editor.html',
  38. controller: AxesEditorCtrl,
  39. };
  40. }