axes_editor.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. yBucketOptions: any[];
  10. xBucketOptions: any[];
  11. /** @ngInject */
  12. constructor($scope, uiSegmentSrv) {
  13. $scope.editor = this;
  14. this.panelCtrl = $scope.ctrl;
  15. this.panel = this.panelCtrl.panel;
  16. this.unitFormats = kbn.getUnitFormats();
  17. this.logScales = {
  18. 'linear': 1,
  19. 'log (base 2)': 2,
  20. 'log (base 10)': 10,
  21. 'log (base 32)': 32,
  22. 'log (base 1024)': 1024
  23. };
  24. this.dataFormats = {
  25. 'Time series': 'timeseries',
  26. 'Time series Pre-bucketed': 'tsbuckets'
  27. };
  28. this.yBucketOptions = [
  29. {text: '5', value: '5'},
  30. {text: '10', value: '10'},
  31. {text: '20', value: '20'},
  32. {text: '30', value: '30'},
  33. {text: '50', value: '50'},
  34. ];
  35. this.xBucketOptions = [
  36. {text: '15', value: '15'},
  37. {text: '20', value: '20'},
  38. {text: '30', value: '30'},
  39. {text: '50', value: '50'},
  40. {text: '1m', value: '1m'},
  41. {text: '5m', value: '5m'},
  42. {text: '10m', value: '10m'},
  43. {text: '20m', value: '20m'},
  44. {text: '1h', value: '1h'},
  45. ];
  46. }
  47. setUnitFormat(subItem) {
  48. this.panel.yAxis.format = subItem.value;
  49. this.panelCtrl.render();
  50. }
  51. }
  52. /** @ngInject */
  53. export function axesEditor() {
  54. 'use strict';
  55. return {
  56. restrict: 'E',
  57. scope: true,
  58. templateUrl: 'public/app/plugins/panel/heatmap/partials/axes_editor.html',
  59. controller: AxesEditorCtrl,
  60. };
  61. }