UNPKG

2.94 kBTypeScriptView Raw
1import { GroupStyleProps, IContext, LayoutProps, Component, Ref } from '@antv/f-engine';
2import { ScaleConfig } from '../deps/f2-scale/src';
3import CoordController, { Coord } from '../controller/coord';
4import ScaleController from '../controller/scale';
5import { Data, DataRecord, DataRecordScale } from './Data';
6import { CoordType, CoordProps } from './Coord';
7export { Point } from './types';
8export interface ChartProps<TRecord extends DataRecord = DataRecord> {
9 data: Data<TRecord>;
10 scale?: DataRecordScale<TRecord>;
11 coord?: CoordType | CoordProps;
12 style?: GroupStyleProps;
13 theme?: Record<string, any>;
14 children?: any;
15}
16export interface ChartState {
17 filters: any;
18}
19export interface ChartChildProps<TRecord extends DataRecord = DataRecord> {
20 data?: Data<TRecord>;
21 chart?: Chart<TRecord>;
22 coord?: Coord;
23 layout?: LayoutProps;
24}
25export interface PositionLayout {
26 position: 'top' | 'right' | 'bottom' | 'left';
27 width: number;
28 height: number;
29}
30export interface ComponentPosition {
31 component: Component;
32 layout: PositionLayout | PositionLayout[];
33}
34declare class Chart<TRecord extends DataRecord = DataRecord, IProps extends ChartProps<TRecord> = ChartProps<TRecord>> extends Component<IProps, ChartState> {
35 private componentsPosition;
36 coord: CoordController;
37 scale: ScaleController;
38 coordRef: Ref;
39 constructor(props: IProps, context?: IContext);
40 private getStyle;
41 willMount(): void;
42 willReceiveProps(nextProps: IProps, context: any): void;
43 willUpdate(): void;
44 on(eventName: string, listener: (...args: any[]) => void): void;
45 off(eventName: string, listener: (...args: any[]) => void): void;
46 layoutCoord(layout: PositionLayout): void;
47 resetCoordLayout(): void;
48 updateCoordLayout(layout: PositionLayout | PositionLayout[]): void;
49 updateCoordFor(component: Component, layout: PositionLayout | PositionLayout[]): void;
50 removeComponentsPositionCache(): void;
51 getGeometrys(): Component<import("@antv/f-engine").IProps, import("@antv/f-engine").IState>[];
52 /**
53 * calculate dataset's position on canvas
54 * @param {Object} record the dataset
55 * @return {Object} return the position
56 */
57 getPosition(record: any): {
58 x: any;
59 y: any;
60 };
61 getSnapRecords(point: any, inCoordRange?: any): any;
62 getRecords(data: any, field: any): any;
63 getLegendItems(point?: any): any;
64 setScale(field: string, option: ScaleConfig): void;
65 getScale(field: string): import("../deps/f2-scale/src").Scale;
66 getScales(): {
67 [field: string]: import("../deps/f2-scale/src").Scale;
68 };
69 getXScales(): any[];
70 getYScales(): any[];
71 getLayout(): import("../controller/coord").Layout;
72 getCoord(): Coord;
73 filter(field: string, condition: any): void;
74 _getRenderData(): Data<TRecord>;
75 render(): import("@antv/f-engine").JSX.Element;
76}
77export default Chart;