1 |
|
2 |
|
3 |
|
4 | import React, { ReactElement, SVGProps } from 'react';
|
5 | import { ImplicitLabelType } from '../component/Label';
|
6 | import { IfOverflow } from '../util/IfOverflowMatches';
|
7 | import { CartesianViewBox, D3Scale } from '../util/types';
|
8 | import { Props as XAxisProps } from './XAxis';
|
9 | import { Props as YAxisProps } from './YAxis';
|
10 | interface InternalReferenceLineProps {
|
11 | viewBox?: CartesianViewBox;
|
12 | xAxis?: Omit<XAxisProps, 'scale'> & {
|
13 | scale: D3Scale<string | number>;
|
14 | };
|
15 | yAxis?: Omit<YAxisProps, 'scale'> & {
|
16 | scale: D3Scale<string | number>;
|
17 | };
|
18 | clipPathId?: number | string;
|
19 | }
|
20 | export type Segment = {
|
21 | x?: number | string;
|
22 | y?: number | string;
|
23 | };
|
24 | export type ReferenceLinePosition = 'middle' | 'start' | 'end';
|
25 | interface ReferenceLineProps extends InternalReferenceLineProps {
|
26 | isFront?: boolean;
|
27 |
|
28 | alwaysShow?: boolean;
|
29 | ifOverflow?: IfOverflow;
|
30 | x?: number | string;
|
31 | y?: number | string;
|
32 | segment?: ReadonlyArray<Segment>;
|
33 | position?: ReferenceLinePosition;
|
34 | className?: number | string;
|
35 | yAxisId?: number | string;
|
36 | xAxisId?: number | string;
|
37 | shape?: ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>);
|
38 | label?: ImplicitLabelType;
|
39 | }
|
40 | /**
|
41 | * This excludes `viewBox` prop from svg for two reasons:
|
42 | * 1. The components wants viewBox of object type, and svg wants string
|
43 | * - so there's a conflict, and the component will throw if it gets string
|
44 | * 2. Internally the component calls `filterProps` which filters the viewBox away anyway
|
45 | */
|
46 | export type Props = Omit<SVGProps<SVGLineElement>, 'viewBox'> & ReferenceLineProps;
|
47 | type EndPointsPropsSubset = {
|
48 | alwaysShow?: boolean;
|
49 | ifOverflow?: IfOverflow;
|
50 | segment?: ReadonlyArray<Segment>;
|
51 | x?: number | string;
|
52 | y?: number | string;
|
53 | };
|
54 | export 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[];
|
55 | export declare class ReferenceLine extends React.Component<Props> {
|
56 | static displayName: string;
|
57 | static defaultProps: {
|
58 | isFront: boolean;
|
59 | ifOverflow: string;
|
60 | xAxisId: number;
|
61 | yAxisId: number;
|
62 | fill: string;
|
63 | stroke: string;
|
64 | fillOpacity: number;
|
65 | strokeWidth: number;
|
66 | position: string;
|
67 | };
|
68 | render(): React.JSX.Element;
|
69 | }
|
70 | export {};
|