mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-24 17:52:45 +00:00
Merge pull request #26101 from pkeuter/add-label-function
Add label render function
This commit is contained in:
commit
ce4ff75ef4
17
types/recharts/index.d.ts
vendored
17
types/recharts/index.d.ts
vendored
@ -6,6 +6,7 @@
|
||||
// Zheyang Song <https://github.com/ZheyangSong>
|
||||
// Rich Baird <https://github.com/richbai90>
|
||||
// Dan Torberg <https://github.com/caspeco-dan>
|
||||
// Peter Keuter <https://github.com/pkeuter>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
@ -163,7 +164,7 @@ export interface AreaProps extends EventAttributes, Partial<PresentationAttribut
|
||||
connectNulls?: boolean;
|
||||
activeDot?: boolean | object | React.ReactElement<any> | ContentRenderer<any>;
|
||||
dot?: boolean | object | React.ReactElement<any> | ContentRenderer<DotProps>;
|
||||
label?: boolean | object | React.ReactElement<any> | LabelProps['content'];
|
||||
label?: boolean | object | ContentRenderer<any> | React.ReactElement<any>;
|
||||
hide?: boolean;
|
||||
layout?: LayoutType;
|
||||
baseLine?: number | any[];
|
||||
@ -207,7 +208,7 @@ export interface BarProps extends EventAttributes, Partial<PresentationAttribute
|
||||
shape?: React.ReactElement<any> | ContentRenderer<RectangleProps>;
|
||||
data?: BarData[];
|
||||
// see label section at http://recharts.org/#/en-US/api/Bar
|
||||
label?: boolean | Label | React.SFC<LabelProps> | React.ReactElement<LabelProps> | ContentRenderer<Label>;
|
||||
label?: boolean | Label | React.SFC<LabelProps> | React.ReactElement<LabelProps> | ContentRenderer<any>;
|
||||
}
|
||||
|
||||
export class Bar extends React.Component<BarProps> { }
|
||||
@ -404,7 +405,7 @@ export interface LineProps extends EventAttributes, Partial<PresentationAttribut
|
||||
width?: number;
|
||||
height?: number;
|
||||
dataKey: DataKey; // As the source code states, dataKey will replace valueKey in 1.1.0 and it'll be required (it's already required in current implementation).
|
||||
label?: boolean | object | React.ReactElement<any> | LabelProps['content'];
|
||||
label?: boolean | object | React.ReactElement<any> | ContentRenderer<any>;
|
||||
points?: Point[];
|
||||
}
|
||||
|
||||
@ -437,8 +438,8 @@ export interface PieProps extends EventAttributes, Partial<PresentationAttribute
|
||||
labelLine?: object | ContentRenderer<LineProps & any> | React.ReactElement<any> | boolean;
|
||||
label?: {
|
||||
offsetRadius: number;
|
||||
} | LabelProps['content'] | React.ReactElement<any> | boolean;
|
||||
activeShape?: object |ContentRenderer<any> | React.ReactElement<any>;
|
||||
} | React.ReactElement<any> | ContentRenderer<any> | boolean;
|
||||
activeShape?: object | ContentRenderer<any> | React.ReactElement<any>;
|
||||
activeIndex?: number | number[];
|
||||
}
|
||||
|
||||
@ -552,7 +553,7 @@ export interface RadarProps extends EventAttributes, Partial<PresentationAttribu
|
||||
shape?: React.ReactElement<any> | ContentRenderer<RadarProps>;
|
||||
activeDot?: object | React.ReactElement<any> | ContentRenderer<any> | boolean;
|
||||
dot?: object | React.ReactElement<any> | ContentRenderer<DotProps> | boolean;
|
||||
label?: object | React.ReactElement<any> | LabelProps['content'] | boolean;
|
||||
label?: object | React.ReactElement<any> | ContentRenderer<any> | boolean;
|
||||
legendType?: LegendType;
|
||||
hide?: boolean;
|
||||
}
|
||||
@ -591,7 +592,7 @@ export interface RadialBarProps extends EventAttributes, Partial<PresentationAtt
|
||||
maxBarSize?: number;
|
||||
data?: RadialBarData[];
|
||||
legendType?: LegendType;
|
||||
label?: boolean | React.ReactElement<any> | LabelProps['content'] | object;
|
||||
label?: boolean | React.ReactElement<any> | ContentRenderer<any> | object;
|
||||
background?: boolean | React.ReactElement<any> | ContentRenderer<any> | object;
|
||||
hide?: boolean;
|
||||
}
|
||||
@ -838,7 +839,7 @@ export interface LabelProps {
|
||||
position?: PositionType;
|
||||
children?: React.ReactNode[] | React.ReactNode;
|
||||
className?: string;
|
||||
content?: React.ReactElement<any> | ContentRenderer<Label>;
|
||||
content?: React.ReactElement<any> | ContentRenderer<any>;
|
||||
}
|
||||
|
||||
export class LabelList extends React.Component<LabelListProps> { }
|
||||
|
||||
@ -160,6 +160,7 @@ class Component extends React.Component<{}, ComponentState> {
|
||||
<ResponsiveContainer>
|
||||
<PieChart width={800} height={400}>
|
||||
<Pie
|
||||
label={(props: {name: string}) => <Label>{name}</Label>}
|
||||
dataKey="value"
|
||||
activeIndex={this.state.activeIndex}
|
||||
activeShape={renderActiveShape}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user