當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript kbn.getUnitFormats函數代碼示例

本文整理匯總了TypeScript中app/core/utils/kbn.getUnitFormats函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript getUnitFormats函數的具體用法?TypeScript getUnitFormats怎麽用?TypeScript getUnitFormats使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了getUnitFormats函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

  /** @ngInject */
  constructor($scope, private $q, private uiSegmentSrv) {
    $scope.editor = this;
    this.activeStyleIndex = 0;
    this.panelCtrl = $scope.ctrl;
    this.panel = this.panelCtrl.panel;
    this.unitFormats = kbn.getUnitFormats();
    this.colorModes = [
      {text: 'Disabled', value: null},
      {text: 'Cell', value: 'cell'},
      {text: 'Value', value: 'value'},
      {text: 'Row', value: 'row'},
    ];
    this.columnTypes = [
      {text: 'Number', value: 'number'},
      {text: 'String', value: 'string'},
      {text: 'Date', value: 'date'},
      {text: 'Hidden', value: 'hidden'}
    ];
    this.fontSizes = ['80%', '90%', '100%', '110%', '120%', '130%', '150%', '160%', '180%', '200%', '220%', '250%'];
    this.dateFormats = [
      {text: 'YYYY-MM-DD HH:mm:ss', value: 'YYYY-MM-DD HH:mm:ss'},
      {text: 'MM/DD/YY h:mm:ss a', value: 'MM/DD/YY h:mm:ss a'},
      {text: 'MMMM D, YYYY LT',  value: 'MMMM D, YYYY LT'},
    ];

    this.getColumnNames = () => {
      if (!this.panelCtrl.table) {
        return [];
      }
      return _.map(this.panelCtrl.table.columns, function(col: any) {
        return col.text;
      });
    };
  }
開發者ID:casaria,項目名稱:grafana-trillium-src-fork,代碼行數:35,代碼來源:column_options.ts

示例2: constructor

  /** @ngInject **/
  constructor(private $scope, private $q) {
    this.panelCtrl = $scope.ctrl;
    this.panel = this.panelCtrl.panel;
    $scope.ctrl = this;

    this.unitFormats = kbn.getUnitFormats();

    this.logScales = {
      'linear': 1,
      'log (base 2)': 2,
      'log (base 10)': 10,
      'log (base 32)': 32,
      'log (base 1024)': 1024
    };

    this.xAxisModes = {
      'Time': 'time',
      'Series': 'series',
      // 'Data field': 'field',
    };

    this.xAxisStatOptions =  [
      {text: 'Avg', value: 'avg'},
      {text: 'Min', value: 'min'},
      {text: 'Max', value: 'min'},
      {text: 'Total', value: 'total'},
      {text: 'Count', value: 'count'},
    ];

    if (this.panel.xaxis.mode === 'custom') {
      if (!this.panel.xaxis.name) {
        this.panel.xaxis.name = 'specify field';
      }
    }
  }
開發者ID:sis-labs,項目名稱:grafana,代碼行數:36,代碼來源:axes_editor.ts

示例3: constructor

  /** @ngInject */
  constructor($scope, uiSegmentSrv) {
    $scope.editor = this;
    this.panelCtrl = $scope.ctrl;
    this.panel = this.panelCtrl.panel;
    this.unitFormats = kbn.getUnitFormats();

    this.logScales = {
      linear: 1,
      'log (base 2)': 2,
      'log (base 10)': 10,
      'log (base 32)': 32,
      'log (base 1024)': 1024,
    };

    this.dataFormats = {
      'Time series': 'timeseries',
      'Time series buckets': 'tsbuckets',
    };

    this.yBucketBoundModes = {
      Auto: 'auto',
      Upper: 'upper',
      Lower: 'lower',
      Middle: 'middle',
    };
  }
開發者ID:grafana,項目名稱:grafana,代碼行數:27,代碼來源:axes_editor.ts

示例4: constructor

  /** @ngInject */
  constructor($scope, uiSegmentSrv) {
    $scope.editor = this;
    this.panelCtrl = $scope.ctrl;
    this.panel = this.panelCtrl.panel;
    this.unitFormats = kbn.getUnitFormats();

    this.logScales = {
      'linear': 1,
      'log (base 2)': 2,
      'log (base 10)': 10,
      'log (base 32)': 32,
      'log (base 1024)': 1024
    };

    this.dataFormats = {
      'Time series': 'timeseries',
      'Time series buckets': 'tsbuckets'
    };
  }
開發者ID:PaulMest,項目名稱:grafana,代碼行數:20,代碼來源:axes_editor.ts

示例5: constructor

  /** @ngInject */
  constructor($scope, private $q, private uiSegmentSrv) {
    $scope.editor = this;
    this.panelCtrl = $scope.ctrl;
    this.panel = this.panelCtrl.panel;
    this.transformers = transformers;
    this.unitFormats = kbn.getUnitFormats();
    this.colorModes = [
      {text: 'Disabled', value: null},
      {text: 'Cell', value: 'cell'},
      {text: 'Value', value: 'value'},
      {text: 'Row', value: 'row'},
    ];
    this.columnTypes = [
      {text: 'Number', value: 'number'},
      {text: 'String', value: 'string'},
      {text: 'Date', value: 'date'},
      {text: 'Hidden', value: 'hidden'}
    ];
    this.alignTypes = [
      {text: 'Auto', value: 'auto'},
      {text: 'Left', value: 'left'},
      {text: 'Center', value: 'center'},
      {text: 'Right', value: 'right'}
    ];
    this.fontSizes = ['80%', '90%', '100%', '110%', '120%', '130%', '150%', '160%', '180%', '200%', '220%', '250%'];
    this.dateFormats = [
      {text: 'YYYY-MM-DD HH:mm:ss', value: 'YYYY-MM-DD HH:mm:ss'},
      {text: 'MM/DD/YY h:mm:ss a', value: 'MM/DD/YY h:mm:ss a'},
      {text: 'MMMM D, YYYY LT',  value: 'MMMM D, YYYY LT'},
    ];

    this.addColumnSegment = uiSegmentSrv.newPlusButton();

    // this is used from bs-typeahead and needs to be instance bound
    this.getColumnNames = () => {
      if (!this.panelCtrl.table) {
        return [];
      }
      return _.map(this.panelCtrl.table.columns, function(col: any) {
        return col.text;
      });
    };
  }
開發者ID:madshall,項目名稱:grafana,代碼行數:44,代碼來源:editor.ts

示例6: constructor

  /** @ngInject */
  constructor($scope) {
    $scope.editor = this;
    this.panelCtrl = $scope.ctrl;
    this.panel = this.panelCtrl.panel;

    this.unitFormats = kbn.getUnitFormats();

    this.logScales = {
      'linear': 1,
      'log (base 2)': 2,
      'log (base 10)': 10,
      'log (base 32)': 32,
      'log (base 1024)': 1024
    };

    this.dataFormats = {
      'Timeseries': 'timeseries',
      'ES histogram': 'es_histogram'
    };
  }
開發者ID:martinwalsh,項目名稱:grafana,代碼行數:21,代碼來源:axes_editor.ts

示例7: constructor

  /** @ngInject */
  constructor($scope, $q, uiSegmentSrv) {
    $scope.transformers = transformers;
    $scope.unitFormats = kbn.getUnitFormats();
    $scope.colorModes = [
      {text: 'Disabled', value: null},
      {text: 'Cell', value: 'cell'},
      {text: 'Value', value: 'value'},
      {text: 'Row', value: 'row'},
    ];
    $scope.columnTypes = [
      {text: 'Number', value: 'number'},
      {text: 'String', value: 'string'},
      {text: 'Date', value: 'date'},
    ];
    $scope.fontSizes = ['80%', '90%', '100%', '110%', '120%', '130%', '150%', '160%', '180%', '200%', '220%', '250%'];
    $scope.dateFormats = [
      {text: 'YYYY-MM-DD HH:mm:ss', value: 'YYYY-MM-DD HH:mm:ss'},
      {text: 'MM/DD/YY h:mm:ss a', value: 'MM/DD/YY h:mm:ss a'},
      {text: 'MMMM D, YYYY LT',  value: 'MMMM D, YYYY LT'},
    ];

    $scope.addColumnSegment = uiSegmentSrv.newPlusButton();

    $scope.getColumnOptions = function() {
      if (!$scope.dataRaw) {
        return $q.when([]);
      }
      var columns = transformers[$scope.panel.transform].getColumns($scope.dataRaw);
      var segments = _.map(columns, (c: any) => uiSegmentSrv.newSegment({value: c.text}));
      return $q.when(segments);
    };

    $scope.addColumn = function() {
      var columns = transformers[$scope.panel.transform].getColumns($scope.dataRaw);
      var column = _.findWhere(columns, {text: $scope.addColumnSegment.value});

      if (column) {
        $scope.panel.columns.push(column);
        $scope.render();
      }

      var plusButton = uiSegmentSrv.newPlusButton();
      $scope.addColumnSegment.html = plusButton.html;
      $scope.addColumnSegment.value = plusButton.value;
    };

    $scope.transformChanged = function() {
      $scope.panel.columns = [];
      $scope.render();
    };

    $scope.removeColumn = function(column) {
      $scope.panel.columns = _.without($scope.panel.columns, column);
      $scope.render();
    };

    $scope.setUnitFormat = function(column, subItem) {
      column.unit = subItem.value;
      $scope.render();
    };

    $scope.addColumnStyle = function() {
      var columnStyleDefaults = {
        unit: 'short',
        type: 'number',
        decimals: 2,
        colors: ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"],
        colorMode: null,
        pattern: '/.*/',
        dateFormat: 'YYYY-MM-DD HH:mm:ss',
        thresholds: [],
      };

      $scope.panel.styles.push(angular.copy(columnStyleDefaults));
    };

    $scope.removeColumnStyle = function(style) {
      $scope.panel.styles = _.without($scope.panel.styles, style);
    };

    $scope.getColumnNames = function() {
      if (!$scope.table) {
        return [];
      }
      return _.map($scope.table.columns, function(col: any) {
        return col.text;
      });
    };

    $scope.invertColorOrder = function(index) {
      var ref = $scope.panel.styles[index].colors;
      var copy = ref[0];
      ref[0] = ref[2];
      ref[2] = copy;
      $scope.render();
    };

  }
開發者ID:windyStreet,項目名稱:grafana,代碼行數:99,代碼來源:editor.ts

示例8: onInitEditMode

 onInitEditMode() {
   this.addEditorTab('Options', 'public/app/plugins/panel/piechart/editor.html', 2);
   this.unitFormats = kbn.getUnitFormats();
 }
開發者ID:YuhangGe,項目名稱:grafana,代碼行數:4,代碼來源:piechart_ctrl.ts


注:本文中的app/core/utils/kbn.getUnitFormats函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。