1 | import React, { PureComponent, ReactElement } from 'react';
|
2 | import { CurveType, Props as CurveProps, Point as CurvePoint } from '../shape/Curve';
|
3 | import { Props as DotProps } from '../shape/Dot';
|
4 | import { ImplicitLabelType } from '../component/Label';
|
5 | import { Props as XAxisProps } from './XAxis';
|
6 | import { Props as YAxisProps } from './YAxis';
|
7 | import { D3Scale, LegendType, TooltipType, AnimationTiming, ChartOffset, DataKey, TickItem, AnimationDuration, ActiveShape } from '../util/types';
|
8 | export type LineDot = ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>) | DotProps | boolean;
|
9 | export interface LinePointItem extends CurvePoint {
|
10 | value?: number;
|
11 | payload?: any;
|
12 | }
|
13 | interface InternalLineProps {
|
14 | top?: number;
|
15 | left?: number;
|
16 | width?: number;
|
17 | height?: number;
|
18 | points?: LinePointItem[];
|
19 | xAxis?: Omit<XAxisProps, 'scale'> & {
|
20 | scale: D3Scale<string | number>;
|
21 | };
|
22 | yAxis?: Omit<YAxisProps, 'scale'> & {
|
23 | scale: D3Scale<string | number>;
|
24 | };
|
25 | }
|
26 | interface LineProps extends InternalLineProps {
|
27 | className?: string;
|
28 | data?: any;
|
29 | type?: CurveType;
|
30 | unit?: string | number;
|
31 | name?: string | number;
|
32 | yAxisId?: string | number;
|
33 | xAxisId?: string | number;
|
34 | dataKey?: DataKey<any>;
|
35 | legendType?: LegendType;
|
36 | tooltipType?: TooltipType;
|
37 | layout?: 'horizontal' | 'vertical';
|
38 | connectNulls?: boolean;
|
39 | hide?: boolean;
|
40 | activeDot?: ActiveShape<DotProps> | DotProps;
|
41 | dot?: LineDot;
|
42 | onAnimationStart?: () => void;
|
43 | onAnimationEnd?: () => void;
|
44 | isAnimationActive?: boolean;
|
45 | animateNewValues?: boolean;
|
46 | animationBegin?: number;
|
47 | animationDuration?: AnimationDuration;
|
48 | animationEasing?: AnimationTiming;
|
49 | animationId?: number;
|
50 | id?: string;
|
51 | label?: ImplicitLabelType;
|
52 | }
|
53 | export type Props = Omit<CurveProps, 'points' | 'pathRef'> & LineProps;
|
54 | interface State {
|
55 | isAnimationFinished?: boolean;
|
56 | totalLength?: number;
|
57 | prevPoints?: LinePointItem[];
|
58 | curPoints?: LinePointItem[];
|
59 | prevAnimationId?: number;
|
60 | }
|
61 | export declare class Line extends PureComponent<Props, State> {
|
62 | static displayName: string;
|
63 | static defaultProps: {
|
64 | xAxisId: number;
|
65 | yAxisId: number;
|
66 | connectNulls: boolean;
|
67 | activeDot: boolean;
|
68 | dot: boolean;
|
69 | legendType: string;
|
70 | stroke: string;
|
71 | strokeWidth: number;
|
72 | fill: string;
|
73 | points: LinePointItem[];
|
74 | isAnimationActive: boolean;
|
75 | animateNewValues: boolean;
|
76 | animationBegin: number;
|
77 | animationDuration: number;
|
78 | animationEasing: string;
|
79 | hide: boolean;
|
80 | label: boolean;
|
81 | };
|
82 | static getComposedData: ({ props, xAxis, yAxis, xAxisTicks, yAxisTicks, dataKey, bandSize, displayedData, offset, }: {
|
83 | props: Props;
|
84 | xAxis: Props['xAxis'];
|
85 | yAxis: Props['yAxis'];
|
86 | xAxisTicks: TickItem[];
|
87 | yAxisTicks: TickItem[];
|
88 | dataKey: Props['dataKey'];
|
89 | bandSize: number;
|
90 | displayedData: any[];
|
91 | offset: ChartOffset;
|
92 | }) => {
|
93 | top?: number;
|
94 | bottom?: number;
|
95 | left?: number;
|
96 | right?: number;
|
97 | width?: number;
|
98 | height?: number;
|
99 | brushBottom?: number;
|
100 | points: {
|
101 | x: number;
|
102 | y: number;
|
103 | value: any;
|
104 | payload: any;
|
105 | }[];
|
106 | layout: "horizontal" | "vertical";
|
107 | };
|
108 | mainCurve?: SVGPathElement;
|
109 | state: State;
|
110 | componentDidMount(): void;
|
111 | componentDidUpdate(): void;
|
112 | static getDerivedStateFromProps(nextProps: Props, prevState: State): State;
|
113 | getTotalLength(): number;
|
114 | generateSimpleStrokeDasharray: (totalLength: number, length: number) => string;
|
115 | getStrokeDasharray: (length: number, totalLength: number, lines: number[]) => string;
|
116 | id: string;
|
117 | pathRef: (node: SVGPathElement) => void;
|
118 | static repeat(lines: number[], count: number): number[];
|
119 | handleAnimationEnd: () => void;
|
120 | handleAnimationStart: () => void;
|
121 | renderErrorBar(needClip: boolean, clipPathId: string): React.JSX.Element;
|
122 | static renderDotItem(option: LineDot, props: any): React.JSX.Element;
|
123 | renderDots(needClip: boolean, clipDot: boolean, clipPathId: string): React.JSX.Element;
|
124 | renderCurveStatically(points: LinePointItem[], needClip: boolean, clipPathId: string, props?: {
|
125 | strokeDasharray: string;
|
126 | }): React.JSX.Element;
|
127 | renderCurveWithAnimation(needClip: boolean, clipPathId: string): React.JSX.Element;
|
128 | renderCurve(needClip: boolean, clipPathId: string): React.JSX.Element;
|
129 | render(): React.JSX.Element;
|
130 | }
|
131 | export {};
|