1 | import React, { Key, PureComponent, ReactElement } from 'react';
|
2 | import { Props as RectangleProps } from '../shape/Rectangle';
|
3 | import { Props as XAxisProps } from './XAxis';
|
4 | import { Props as YAxisProps } from './YAxis';
|
5 | import { D3Scale, TooltipType, LegendType, AnimationTiming, ChartOffset, DataKey, TickItem, PresentationAttributesAdaptChildEvent, AnimationDuration, ActiveShape } from '../util/types';
|
6 | import { ImplicitLabelType } from '../component/Label';
|
7 | import { MinPointSize } from '../util/BarUtils';
|
8 | export interface BarRectangleItem extends RectangleProps {
|
9 | value?: number | [number, number];
|
10 | background?: {
|
11 | x?: number;
|
12 | y?: number;
|
13 | width?: number;
|
14 | height?: number;
|
15 | };
|
16 | }
|
17 | interface InternalBarProps {
|
18 | xAxis?: Omit<XAxisProps, 'scale'> & {
|
19 | scale: D3Scale<string | number>;
|
20 | x?: number;
|
21 | width?: number;
|
22 | };
|
23 | yAxis?: Omit<YAxisProps, 'scale'> & {
|
24 | scale: D3Scale<string | number>;
|
25 | y?: number;
|
26 | height?: number;
|
27 | };
|
28 | data?: BarRectangleItem[];
|
29 | top?: number;
|
30 | left?: number;
|
31 | width?: number;
|
32 | height?: number;
|
33 | }
|
34 | export interface BarProps extends InternalBarProps {
|
35 | className?: string;
|
36 | index?: Key;
|
37 | activeIndex?: number;
|
38 | layout?: 'horizontal' | 'vertical';
|
39 | xAxisId?: string | number;
|
40 | yAxisId?: string | number;
|
41 | stackId?: string | number;
|
42 | barSize?: number;
|
43 | unit?: string | number;
|
44 | name?: string | number;
|
45 | dataKey: DataKey<any>;
|
46 | tooltipType?: TooltipType;
|
47 | legendType?: LegendType;
|
48 | minPointSize?: MinPointSize;
|
49 | maxBarSize?: number;
|
50 | hide?: boolean;
|
51 | shape?: ActiveShape<BarProps, SVGPathElement>;
|
52 | activeBar?: ActiveShape<BarProps, SVGPathElement>;
|
53 | background?: ActiveShape<BarProps, SVGPathElement>;
|
54 | radius?: number | [number, number, number, number];
|
55 | onAnimationStart?: () => void;
|
56 | onAnimationEnd?: () => void;
|
57 | isAnimationActive?: boolean;
|
58 | animationBegin?: number;
|
59 | animationDuration?: AnimationDuration;
|
60 | animationEasing?: AnimationTiming;
|
61 | animationId?: number;
|
62 | id?: string;
|
63 | label?: ImplicitLabelType;
|
64 | }
|
65 | export type Props = Omit<PresentationAttributesAdaptChildEvent<any, SVGPathElement>, 'radius' | 'name'> & BarProps;
|
66 | interface State {
|
67 | readonly isAnimationFinished?: boolean;
|
68 | readonly prevData?: BarRectangleItem[];
|
69 | readonly curData?: BarRectangleItem[];
|
70 | readonly prevAnimationId?: number;
|
71 | }
|
72 | export declare class Bar extends PureComponent<Props, State> {
|
73 | static displayName: string;
|
74 | static defaultProps: {
|
75 | xAxisId: number;
|
76 | yAxisId: number;
|
77 | legendType: string;
|
78 | minPointSize: number;
|
79 | hide: boolean;
|
80 | data: BarRectangleItem[];
|
81 | layout: string;
|
82 | activeBar: boolean;
|
83 | isAnimationActive: boolean;
|
84 | animationBegin: number;
|
85 | animationDuration: number;
|
86 | animationEasing: string;
|
87 | };
|
88 | static getComposedData: ({ props, item, barPosition, bandSize, xAxis, yAxis, xAxisTicks, yAxisTicks, stackedData, dataStartIndex, displayedData, offset, }: {
|
89 | props: Props;
|
90 | item: ReactElement;
|
91 | barPosition: any;
|
92 | bandSize: number;
|
93 | xAxis: InternalBarProps['xAxis'];
|
94 | yAxis: InternalBarProps['yAxis'];
|
95 | xAxisTicks: TickItem[];
|
96 | yAxisTicks: TickItem[];
|
97 | stackedData: Array<[number, number]>;
|
98 | dataStartIndex: number;
|
99 | offset: ChartOffset;
|
100 | displayedData: any[];
|
101 | }) => {
|
102 | top?: number;
|
103 | bottom?: number;
|
104 | left?: number;
|
105 | right?: number;
|
106 | width?: number;
|
107 | height?: number;
|
108 | brushBottom?: number;
|
109 | data: any[];
|
110 | layout: "horizontal" | "vertical";
|
111 | };
|
112 | state: State;
|
113 | static getDerivedStateFromProps(nextProps: Props, prevState: State): State;
|
114 | id: string;
|
115 | handleAnimationEnd: () => void;
|
116 | handleAnimationStart: () => void;
|
117 | renderRectanglesStatically(data: BarRectangleItem[]): React.JSX.Element[];
|
118 | renderRectanglesWithAnimation(): React.JSX.Element;
|
119 | renderRectangles(): React.JSX.Element | React.JSX.Element[];
|
120 | renderBackground(): React.JSX.Element[];
|
121 | renderErrorBar(needClip: boolean, clipPathId: string): React.JSX.Element;
|
122 | render(): React.JSX.Element;
|
123 | }
|
124 | export {};
|