UNPKG

2.2 kBTypeScriptView Raw
1import React, { ReactElement, SVGProps } from 'react';
2import { ImplicitLabelType } from '../component/Label';
3import { IfOverflow } from '../util/IfOverflowMatches';
4import { CartesianViewBox, D3Scale } from '../util/types';
5import { Props as XAxisProps } from './XAxis';
6import { Props as YAxisProps } from './YAxis';
7interface InternalReferenceLineProps {
8 viewBox?: CartesianViewBox;
9 xAxis?: Omit<XAxisProps, 'scale'> & {
10 scale: D3Scale<string | number>;
11 };
12 yAxis?: Omit<YAxisProps, 'scale'> & {
13 scale: D3Scale<string | number>;
14 };
15 clipPathId?: number | string;
16}
17export type Segment = {
18 x?: number | string;
19 y?: number | string;
20};
21export type ReferenceLinePosition = 'middle' | 'start' | 'end';
22interface ReferenceLineProps extends InternalReferenceLineProps {
23 isFront?: boolean;
24 alwaysShow?: boolean;
25 ifOverflow?: IfOverflow;
26 x?: number | string;
27 y?: number | string;
28 segment?: ReadonlyArray<Segment>;
29 position?: ReferenceLinePosition;
30 className?: number | string;
31 yAxisId?: number | string;
32 xAxisId?: number | string;
33 shape?: ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>);
34 label?: ImplicitLabelType;
35}
36export type Props = Omit<SVGProps<SVGLineElement>, 'viewBox'> & ReferenceLineProps;
37type EndPointsPropsSubset = {
38 alwaysShow?: boolean;
39 ifOverflow?: IfOverflow;
40 segment?: ReadonlyArray<Segment>;
41 x?: number | string;
42 y?: number | string;
43};
44export declare const getEndPoints: (scales: any, isFixedX: boolean, isFixedY: boolean, isSegment: boolean, viewBox: CartesianViewBox, position: Props['position'], xAxisOrientation: XAxisProps['orientation'], yAxisOrientation: YAxisProps['orientation'], props: EndPointsPropsSubset) => any[];
45export declare function ReferenceLine(props: Props): React.JSX.Element;
46export declare namespace ReferenceLine {
47 var displayName: string;
48 var defaultProps: {
49 isFront: boolean;
50 ifOverflow: string;
51 xAxisId: number;
52 yAxisId: number;
53 fill: string;
54 stroke: string;
55 fillOpacity: number;
56 strokeWidth: number;
57 position: string;
58 };
59}
60export {};