UNPKG

4.12 kBTypeScriptView Raw
1import { ChartChildProps } from '../../chart';
2import Selection, { SelectionProps, SelectionState } from './selection';
3import { Adjust } from '../../deps/f2-adjust/src';
4import AttrController from '../../controller/attr';
5import { Scale } from '../../deps/f2-scale/src';
6import { AnimationProps } from '@antv/f-engine';
7import { AdjustType, AdjustProps } from './Adjust';
8import { DataRecord, DataField } from '../../chart/Data';
9export type GeometryType = 'line' | 'point' | 'area' | 'polygon' | 'schema' | 'interval';
10export interface ColorAttrObject {
11 type?: string;
12 field?: string;
13 range?: any[];
14 callback?: (...args: any[]) => any;
15 scale?: any;
16}
17export interface SizeAttrObject {
18 type?: string;
19 field?: string;
20 range?: any[];
21 callback?: (...args: any[]) => any;
22 scale?: any;
23}
24export interface ShapeAttrObject {
25 type?: string;
26 field?: string;
27 range?: any[];
28 callback?: (...args: any[]) => any;
29 scale?: any;
30}
31export interface GeometryProps<TRecord extends DataRecord = DataRecord> extends SelectionProps {
32 x: DataField<TRecord>;
33 y: DataField<TRecord>;
34 color?: DataField<TRecord> | string | [string, any[]] | ColorAttrObject;
35 size?: DataField<TRecord> | number | string | [string, any[]] | SizeAttrObject;
36 shape?: DataField<TRecord> | number | string | [string, any[]] | ShapeAttrObject;
37 adjust?: AdjustType | AdjustProps;
38 startOnZero?: boolean;
39 style?: any;
40 animation?: AnimationProps;
41 /**
42 * 是否裁剪显示区
43 */
44 viewClip?: boolean;
45 onPress?: Function;
46 onPan?: Function;
47 onPressStart?: Function;
48 onPressEnd?: Function;
49 onPanStart?: Function;
50 onPanEnd?: Function;
51}
52declare class Geometry<TRecord extends DataRecord = DataRecord, P extends GeometryProps<TRecord> = GeometryProps<TRecord>, S extends SelectionState = SelectionState> extends Selection<P & ChartChildProps, S> {
53 isGeometry: boolean;
54 geomType: GeometryType;
55 attrs: any;
56 adjust: AdjustProps & {
57 adjust: Adjust;
58 };
59 dataArray: any;
60 dataRecords: any[];
61 records: any[];
62 mappedArray: any;
63 justifyContent: boolean;
64 startOnZero: boolean;
65 connectNulls: boolean;
66 sortable: boolean;
67 attrController: AttrController;
68 animation: AnimationProps;
69 getDefaultCfg(): {};
70 constructor(props: P & ChartChildProps, context?: any);
71 getAttrOptions(props: any): {};
72 willReceiveProps(nextProps: any): void;
73 willMount(): void;
74 willUpdate(): void;
75 didMount(): void;
76 _initEvent(): void;
77 _createAttrs(): void;
78 _getThemeAttrsRange(): {
79 x: import("../../coord/types").Range;
80 y: import("../../coord/types").Range;
81 color: any;
82 size: any;
83 shape: any;
84 };
85 _createAdjust(): AdjustProps & {
86 adjust: Adjust;
87 };
88 _adjustScales(): void;
89 _groupData(data: any): any[];
90 _saveOrigin(originData: any): any[];
91 _numberic(data: any): void;
92 _adjustData(records: any): any;
93 _processData(): void;
94 _readjustData(records: any): void;
95 _sortData(records: any): void;
96 getY0Value(): any;
97 _getShapeStyle(shape: any, origin: any): any;
98 /**
99 * 数据映射到视图属性核心逻辑
100 * x、y 每个元素走 normalize 然后 convertPoint
101 * color、size、shape
102 * 如果是Linear,则每个元素 走 mapping
103 * 如果是Category/Identity 则第一个元素走 mapping
104 */
105 _mapping(records: any): any[];
106 mapping(): any[];
107 getClip(): {
108 type: string;
109 style: {
110 x: number;
111 y: number;
112 width: number;
113 height: number;
114 };
115 };
116 getAttr(attrName: string): any;
117 getXScale(): Scale;
118 getYScale(): Scale;
119 _getXSnap(invertPointX: any): any;
120 _getYSnapRecords(invertPointY: any, records: any): any;
121 _getXSnapRecords(invertPointX: any, records: any): any;
122 flatRecords(): any;
123 getSnapRecords(point: any, inCoordRange?: any): any[];
124 getRecords(data: any, field?: string): any[];
125 getLegendItems(): any;
126}
127export default Geometry;