[recharts] Allow DataKey function to return null, and add missing attributes to LineProps & XAxisProps (#27751)

This commit is contained in:
Harry Cruse
2018-08-01 19:39:29 +01:00
committed by Sheetal Nandi
parent 13f8c453e1
commit e24f2b1508

View File

@@ -9,6 +9,7 @@
// Peter Keuter <https://github.com/pkeuter>
// Jamie Saunders <https://github.com/jrsaunde>
// Paul Melnikow <https://github.com/paulmelnikow>
// Harry Cruse <https://github.com/crusectrl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -25,7 +26,7 @@ export type TooltipFormatter = (value: string | number | Array<string | number>,
entry: TooltipPayload, index: number) => React.ReactNode;
export type ItemSorter<T> = (a: T, b: T) => number;
export type ContentRenderer<P> = (props: P) => React.ReactNode;
export type DataKey = string | number | ((dataObject: any) => number | [number, number]);
export type DataKey = string | number | ((dataObject: any) => number | [number, number] | null);
export type IconType = 'plainline' | 'line' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'plainline';
export type LegendType = IconType | 'none';
@@ -406,6 +407,7 @@ export interface LineProps extends EventAttributes, Partial<PresentationAttribut
left?: number;
width?: number;
height?: number;
data?: object[];
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> | ContentRenderer<any>;
points?: Point[];
@@ -914,6 +916,7 @@ export interface XAxisProps extends EventAttributes {
reversed?: boolean;
// see label section at http://recharts.org/#/en-US/api/XAxis
label?: string | number | Label | LabelProps;
allowDuplicatedCategory?: boolean;
}
export class XAxis extends React.Component<XAxisProps> { }