本文整理匯總了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;
};