/** * data transforms * * @packageDocumentation */ /** * @public */ export declare interface Action { type: ActionType; field: string | null; as: string | null; options?: FillNullOptions; } /** * @public */ export declare type ActionType = AggregationType | ConversionType | FillType; /** * @public */ export declare type AggExtractorPair = { agg: AggregationType; measure: string; }; /** * * @param rows - 数据 * @param options - 参数 * * @public */ export declare function aggregate(rows: RowData[], options: AggregateParams): RowData[]; /** * @public */ export declare interface AggregateParams { as: string[]; fields?: string[]; groupBy?: string | string[]; op: Operations[]; } /** * @public */ export declare const AGGREGATION: ["sum", "max", "min", "average", "avg", "median", "count", "distinct", "countd"]; /** * @public */ export declare type AggregationType = typeof AGGREGATION[number]; /** * @public */ export declare type AllSubspaceDatasetOptions = { dimensions?: string[]; measures?: string[]; aggregations?: AggregationType[]; extractors?: ExtractorType[]; depth?: number; }; /** * @public */ export declare function autoSchema(data: RowData[], renameOption?: RenameOption, defaultAgg?: AggregationType): TransformSchema[]; /** * @public */ export declare function autoTransform(data: RowData[], renameOption?: RenameOption, defaultAgg?: AggregationType): AutoTransformResult; /** * @public */ export declare interface AutoTransformResult { result: RowData[]; schemas: TransformSchema[]; } /** * @public */ export declare type ColumnInfo = { name: string; data: any[]; domain: any[]; }; /** * @public */ export declare function compositeExtractor(siblingGroup: SiblingGroup, aggPair: AggExtractorPair, extractorPairs?: SubExtractorPair[], depth?: number): RowData[]; /** * @public */ export declare const CONVERSION: ["toString", "toFloat", "toInt"]; /** * @public */ export declare type ConversionType = typeof CONVERSION[number]; /** * @public */ export declare class Dataset { private _dataset; private _dimensions; private _measures; private _dimensionTitles; private _measureTitles; constructor(dataset: RowData[]); get dataset(): RowData[]; set dataset(dataset: RowData[]); get dimensions(): ColumnInfo[]; get measures(): ColumnInfo[]; get dimensionTitles(): string[]; get measureTitles(): string[]; private _calculateDimensionsAndMeasures; subspace(defineArray?: string[]): Subspace; siblingGroup(subspace: Subspace, dimension: string): SiblingGroup; allSubspaceDataset(options?: AllSubspaceDatasetOptions): RowData[][]; } /** * @public */ export declare type Extractor = (siblingGroup: SiblingGroup) => Measure[]; /** * @public */ export declare const EXTRACTORS: ["rank", "percent"]; /** * @public */ export declare const extractors: Record; /** * @public */ export declare type ExtractorType = typeof EXTRACTORS[number]; /** * @public */ export declare const FILL: ["fillNull", "removeNull"]; /** * @public */ export declare type FillNullOptions = FillNullOptionsBySmart | FillNullOptionsByAgg | FillNullOptionsByValue; /** * @public */ export declare interface FillNullOptionsByAgg { type: Extract; cfg: { agg: AggregationType; }; } /** * @public */ export declare interface FillNullOptionsBySmart { type: Extract; } /** * @public */ export declare interface FillNullOptionsByValue { type: Extract; cfg: { value: string | number; }; } /** * @public */ export declare type FillNullType = 'bySmart' | 'byAgg' | 'byValue'; /** * @public */ export declare type FillType = typeof FILL[number]; /** * @public */ export declare type Measure = number[]; /** * aggregate operation * @public */ export declare type Operations = 'sum' | 'average' | 'avg' | 'mean' | 'min' | 'max' | 'median' | 'variance' | 'stdevp' | 'stdev' | 'mode' | 'product' | 'count' | 'distinct' | 'countd' | 'valid'; /** * @public */ export declare function parse(data: RowData[], schemas: TransformSchema | TransformSchema[]): RowData[]; /** * @public */ export declare type RenameOption = boolean | 'origin' | 'brackets' | 'underline' | Function; /** * 数据行 * @public */ export declare type RowData = Record; /** * @public */ export declare type SiblingGroup = { datasetInfo: { dimensionTitles: string[]; measureTitles: string[]; }; define: { subspace: Subspace; dimension: string; }; subspaceList: Subspace[]; dataset: RowData[]; }; /** * @public */ export declare type SubExtractorPair = { extractor: ExtractorType; dimension: string; }; /** * @public */ export declare type Subspace = { define: Record; dataset: RowData[]; }; /** * @public */ export declare interface TransformSchema { groupBy?: string[]; actions: Action[]; } /** * Pivot specific field of each values. * @public * @param field - field * @param values - unstack values * @returns row datas */ export declare function unstack(data: RowData[], field: string, values: string[]): RowData[]; export { }