本文整理汇总了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,
};
};
示例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;
};