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


TypeScript date_histogram.setBounds函數代碼示例

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


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

示例1: setBounds

  const createSchemaConfig = (accessor: number, agg: AggConfig): SchemaConfig => {
    if (agg.type.name === 'date_histogram') {
      agg.params.timeRange = timeRange;
      setBounds(agg, true);
    }

    const hasSubAgg = [
      'derivative',
      'moving_avg',
      'serial_diff',
      'cumulative_sum',
      'sum_bucket',
      'avg_bucket',
      'min_bucket',
      'max_bucket',
    ].includes(agg.type.name);

    const format = createFormat(
      hasSubAgg ? agg.params.customMetric || agg.aggConfigs.byId[agg.params.metricAgg] : agg
    );

    const params: SchemaConfigParams = {};

    if (agg.type.name === 'geohash_grid') {
      params.precision = agg.params.precision;
      params.useGeocentroid = agg.params.useGeocentroid;
    }

    return {
      accessor,
      format,
      params,
      aggType: agg.type.name,
    };
  };
開發者ID:spalger,項目名稱:kibana,代碼行數:35,代碼來源:build_pipeline.ts

示例2: setBounds

  const createSchemaConfig = (accessor: number, agg: AggConfig): SchemaConfig => {
    const schema = {
      accessor,
      format: {},
      params: {},
      aggType: agg.type.name,
    };

    if (agg.type.name === 'date_histogram') {
      agg.params.timeRange = timeRange;
      setBounds(agg, true);
    }
    if (agg.type.name === 'geohash_grid') {
      schema.params = {
        precision: agg.params.precision,
        useGeocentroid: agg.params.useGeocentroid,
      };
    }

    if (
      [
        'derivative',
        'moving_avg',
        'serial_diff',
        'cumulative_sum',
        'sum_bucket',
        'avg_bucket',
        'min_bucket',
        'max_bucket',
      ].includes(agg.type.name)
    ) {
      const subAgg = agg.params.customMetric || agg.aggConfigs.byId[agg.params.metricAgg];
      schema.format = createFormat(subAgg);
    } else {
      schema.format = createFormat(agg);
    }

    return schema;
  };
開發者ID:liuyepiaoxiang,項目名稱:kibana,代碼行數:39,代碼來源:build_pipeline.ts


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