1 | import React, { ReactElement, ReactNode, Component, SVGProps } from 'react';
|
2 | import { CartesianViewBox, PresentationAttributesAdaptChildEvent, CartesianTickItem, AxisInterval } from '../util/types';
|
3 | export type Orientation = 'top' | 'bottom' | 'left' | 'right';
|
4 | export type Unit = string | number;
|
5 | export type TickFormatter = (value: any, index: number) => string;
|
6 | export interface CartesianAxisProps {
|
7 | className?: string;
|
8 | x?: number;
|
9 | y?: number;
|
10 | width?: number;
|
11 | height?: number;
|
12 | unit?: Unit;
|
13 | orientation?: Orientation;
|
14 | viewBox?: CartesianViewBox;
|
15 | tick?: SVGProps<SVGTextElement> | ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>) | boolean;
|
16 | axisLine?: boolean | SVGProps<SVGLineElement>;
|
17 | tickLine?: boolean | SVGProps<SVGLineElement>;
|
18 | mirror?: boolean;
|
19 | tickMargin?: number;
|
20 | hide?: boolean;
|
21 | label?: any;
|
22 | minTickGap?: number;
|
23 | ticks?: CartesianTickItem[];
|
24 | tickSize?: number;
|
25 | tickFormatter?: TickFormatter;
|
26 | ticksGenerator?: (props?: CartesianAxisProps) => CartesianTickItem[];
|
27 | interval?: AxisInterval;
|
28 | angle?: number;
|
29 | }
|
30 | interface IState {
|
31 | fontSize: string;
|
32 | letterSpacing: string;
|
33 | }
|
34 | export type Props = Omit<PresentationAttributesAdaptChildEvent<any, SVGElement>, 'viewBox'> & CartesianAxisProps;
|
35 | export declare class CartesianAxis extends Component<Props, IState> {
|
36 | static displayName: string;
|
37 | static defaultProps: {
|
38 | x: number;
|
39 | y: number;
|
40 | width: number;
|
41 | height: number;
|
42 | viewBox: {
|
43 | x: number;
|
44 | y: number;
|
45 | width: number;
|
46 | height: number;
|
47 | };
|
48 | orientation: string;
|
49 | ticks: CartesianTickItem[];
|
50 | stroke: string;
|
51 | tickLine: boolean;
|
52 | axisLine: boolean;
|
53 | tick: boolean;
|
54 | mirror: boolean;
|
55 | minTickGap: number;
|
56 | tickSize: number;
|
57 | tickMargin: number;
|
58 | interval: string;
|
59 | };
|
60 | private layerReference;
|
61 | constructor(props: Props);
|
62 | shouldComponentUpdate({ viewBox, ...restProps }: Props, nextState: IState): boolean;
|
63 | componentDidMount(): void;
|
64 | getTickLineCoord(data: CartesianTickItem): {
|
65 | line: {
|
66 | x1: number;
|
67 | y1: number;
|
68 | x2: number;
|
69 | y2: number;
|
70 | };
|
71 | tick: {
|
72 | x: number;
|
73 | y: number;
|
74 | };
|
75 | };
|
76 | getTickTextAnchor(): string;
|
77 | getTickVerticalAnchor(): string;
|
78 | renderAxisLine(): React.JSX.Element;
|
79 | static renderTickItem(option: Props['tick'], props: any, value: ReactNode): React.JSX.Element;
|
80 | renderTicks(ticks: CartesianTickItem[], fontSize: string, letterSpacing: string): React.JSX.Element;
|
81 | render(): React.JSX.Element;
|
82 | }
|
83 | export {};
|