1 | import React, { ReactElement, SVGProps } from 'react';
|
2 | import { ChartOffset, D3Scale } from '../util/types';
|
3 | import { Props as XAxisProps } from './XAxis';
|
4 | import { Props as YAxisProps } from './YAxis';
|
5 | type XAxisWithD3Scale = Omit<XAxisProps, 'scale'> & {
|
6 | scale: D3Scale<string | number>;
|
7 | };
|
8 | type YAxisWithD3Scale = Omit<YAxisProps, 'scale'> & {
|
9 | scale: D3Scale<string | number>;
|
10 | };
|
11 | export type GridLineTypeFunctionProps = Omit<LineItemProps, 'key'> & {
|
12 | key: LineItemProps['key'] | undefined;
|
13 | offset: ChartOffset;
|
14 | xAxis: null | XAxisWithD3Scale;
|
15 | yAxis: null | YAxisWithD3Scale;
|
16 | };
|
17 | type GridLineType = SVGProps<SVGLineElement> | ReactElement<SVGElement> | ((props: GridLineTypeFunctionProps) => ReactElement<SVGElement>) | boolean;
|
18 | export type HorizontalCoordinatesGenerator = (props: {
|
19 | yAxis: any;
|
20 | width: number;
|
21 | height: number;
|
22 | offset: ChartOffset;
|
23 | }, syncWithTicks: boolean) => number[];
|
24 | export type VerticalCoordinatesGenerator = (props: {
|
25 | xAxis: any;
|
26 | width: number;
|
27 | height: number;
|
28 | offset: ChartOffset;
|
29 | }, syncWithTicks: boolean) => number[];
|
30 | interface InternalCartesianGridProps {
|
31 | width?: number;
|
32 | height?: number;
|
33 | horizontalCoordinatesGenerator?: HorizontalCoordinatesGenerator;
|
34 | verticalCoordinatesGenerator?: VerticalCoordinatesGenerator;
|
35 | }
|
36 | interface CartesianGridProps extends InternalCartesianGridProps {
|
37 | x?: number;
|
38 | y?: number;
|
39 | horizontal?: GridLineType;
|
40 | vertical?: GridLineType;
|
41 | horizontalPoints?: number[];
|
42 | verticalPoints?: number[];
|
43 | verticalFill?: string[];
|
44 | horizontalFill?: string[];
|
45 | syncWithTicks?: boolean;
|
46 | horizontalValues?: number[] | string[];
|
47 | verticalValues?: number[] | string[];
|
48 | }
|
49 | type AcceptedSvgProps = Omit<SVGProps<SVGElement>, 'offset'>;
|
50 | export type Props = AcceptedSvgProps & CartesianGridProps;
|
51 | type LineItemProps = Props & {
|
52 | offset: ChartOffset;
|
53 | xAxis: null | XAxisWithD3Scale;
|
54 | yAxis: null | YAxisWithD3Scale;
|
55 | x1: number;
|
56 | y1: number;
|
57 | x2: number;
|
58 | y2: number;
|
59 | key: string;
|
60 | index: number;
|
61 | };
|
62 | export declare function CartesianGrid(props: Props): React.JSX.Element;
|
63 | export declare namespace CartesianGrid {
|
64 | var displayName: string;
|
65 | }
|
66 | export {};
|