@qn-pandora/pandora-visualization
Version:
Pandora 通用可视化库
25 lines (24 loc) • 1.19 kB
TypeScript
import { IChartField } from '@qn-pandora/app-sdk';
import { DrillDownType, IDrillDownToken, IToDrillEventOfType } from '../../constants/drill-down';
import { IBucket, IMetric } from '../../constants/action-event';
export declare const DEFAULT_SPAN = "5m";
/**
* 提供图表下钻相关的服务:
* 1. 封装根据点击元素生成约定Event的逻辑
* 2. 设置下钻相关的token,可作为模板变量使用
*/
export default abstract class ChartDrillDownService<T = any> {
type: DrillDownType;
abstract toSearchAutoEvent(params: T): IToDrillEventOfType[DrillDownType.ToSearchAuto];
abstract toDrillDownToken(params: any): IDrillDownToken;
toCommonEvent(): undefined;
toEvent(params: T): {
buckets: IBucket[];
metrics?: IMetric[] | undefined;
} | undefined;
generateBucket(fieldname: string, value: any, fields: IChartField[]): IBucket;
generateMetric(fieldname: string, value: any): IMetric;
generateValidResults(res: IToDrillEventOfType[DrillDownType.ToSearchAuto]): IToDrillEventOfType[DrillDownType.ToSearchAuto];
isFieldValid(fieldname: string, value: any): boolean;
constructor(type: DrillDownType);
}