UNPKG

4.14 kBTypeScriptView Raw
1import React, { PureComponent, ReactElement } from 'react';
2import { ImplicitLabelListType } from '../component/LabelList';
3import { Props as ZAxisProps } from './ZAxis';
4import { Props as CurveProps, CurveType } from '../shape/Curve';
5import { Props as ErrorBarProps } from './ErrorBar';
6import { LegendType, AnimationTiming, D3Scale, ChartOffset, DataKey, TickItem, PresentationAttributesAdaptChildEvent, AnimationDuration, ActiveShape, SymbolType } from '../util/types';
7import { TooltipType } from '../component/DefaultTooltipContent';
8import { Props as XAxisProps } from './XAxis';
9import { Props as YAxisProps } from './YAxis';
10import { InnerSymbolsProp } from '../shape/Symbols';
11interface ScattterPointNode {
12 x?: number | string;
13 y?: number | string;
14 z?: number | string;
15}
16export interface ScatterPointItem {
17 cx?: number;
18 cy?: number;
19 size?: number;
20 node?: ScattterPointNode;
21 payload?: any;
22}
23export type ScatterCustomizedShape = ActiveShape<ScatterPointItem, SVGPathElement & InnerSymbolsProp> | SymbolType;
24interface ScatterProps {
25 data?: any[];
26 xAxisId?: string | number;
27 yAxisId?: string | number;
28 zAxisId?: string | number;
29 left?: number;
30 top?: number;
31 width?: number;
32 height?: number;
33 xAxis?: Omit<XAxisProps, 'scale'> & {
34 scale: D3Scale<string | number>;
35 };
36 yAxis?: Omit<YAxisProps, 'scale'> & {
37 scale: D3Scale<string | number>;
38 };
39 zAxis?: Omit<ZAxisProps, 'scale'> & {
40 scale: D3Scale<string | number>;
41 };
42 dataKey?: DataKey<any>;
43 line?: ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>) | CurveProps | boolean;
44 lineType?: 'fitting' | 'joint';
45 lineJointType?: CurveType;
46 legendType?: LegendType;
47 tooltipType?: TooltipType;
48 className?: string;
49 name?: string | number;
50 activeIndex?: number;
51 activeShape?: ScatterCustomizedShape;
52 shape?: ScatterCustomizedShape;
53 points?: ScatterPointItem[];
54 hide?: boolean;
55 label?: ImplicitLabelListType<any>;
56 isAnimationActive?: boolean;
57 animationId?: number;
58 animationBegin?: number;
59 animationDuration?: AnimationDuration;
60 animationEasing?: AnimationTiming;
61}
62export type Props = PresentationAttributesAdaptChildEvent<any, SVGElement> & ScatterProps;
63interface State {
64 isAnimationFinished?: boolean;
65 prevPoints?: ScatterPointItem[];
66 curPoints?: ScatterPointItem[];
67 prevAnimationId?: number;
68}
69export declare class Scatter extends PureComponent<Props, State> {
70 static displayName: string;
71 static defaultProps: {
72 xAxisId: number;
73 yAxisId: number;
74 zAxisId: number;
75 legendType: string;
76 lineType: string;
77 lineJointType: string;
78 data: any[];
79 shape: string;
80 hide: boolean;
81 isAnimationActive: boolean;
82 animationBegin: number;
83 animationDuration: number;
84 animationEasing: string;
85 };
86 static getComposedData: ({ xAxis, yAxis, zAxis, item, displayedData, xAxisTicks, yAxisTicks, offset, }: {
87 props: Props;
88 xAxis: Props['xAxis'];
89 yAxis: Props['yAxis'];
90 zAxis: Props['zAxis'];
91 xAxisTicks: TickItem[];
92 yAxisTicks: TickItem[];
93 item: Scatter;
94 bandSize: number;
95 displayedData: any[];
96 offset: ChartOffset;
97 }) => {
98 top?: number;
99 bottom?: number;
100 left?: number;
101 right?: number;
102 width?: number;
103 height?: number;
104 brushBottom?: number;
105 points: any[];
106 };
107 state: State;
108 static getDerivedStateFromProps(nextProps: Props, prevState: State): State;
109 handleAnimationEnd: () => void;
110 handleAnimationStart: () => void;
111 id: string;
112 renderSymbolsStatically(points: ScatterPointItem[]): React.JSX.Element[];
113 renderSymbolsWithAnimation(): React.JSX.Element;
114 renderSymbols(): React.JSX.Element | React.JSX.Element[];
115 renderErrorBar(): React.ReactElement<ErrorBarProps, string | React.JSXElementConstructor<any>>[];
116 renderLine(): React.JSX.Element;
117 render(): React.JSX.Element;
118}
119export {};