From c9123e006f43073c30f63f42c8e3e7d3a9246585 Mon Sep 17 00:00:00 2001 From: Roy Xue Date: Thu, 14 Sep 2017 17:03:28 -0700 Subject: [PATCH 1/3] Add new label type for X/YAxis --- types/recharts/index.d.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index ee3a8bba30..1e4431ed71 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -714,6 +714,13 @@ export interface XPadding { left: number; right: number; } +export interface XLabel { + value: string; + position?: string; + offset?: number; + stroke?: string; + fontSize?: number; +} export interface XAxisProps { hide?: boolean; dataKey?: string | number; @@ -737,7 +744,7 @@ export interface XAxisProps { tick?: boolean | any | React.ReactElement; mirror?: boolean; reversed?: boolean; - label?: string | number | React.ReactElement; + label?: string | number | React.ReactElement | XLabel; scale?: ScaleType | RechartsFunction; unit?: string | number; name?: string | number; @@ -757,6 +764,13 @@ export interface YPadding { top: number; bottom: number; } +export interface YLabel { + value: string; + position?: string; + offset?: number; + stroke?: string; + fontSize?: number; +} export interface YAxisProps { hide?: boolean; dataKey?: string | number; @@ -780,7 +794,7 @@ export interface YAxisProps { tick?: boolean | any | React.ReactElement; mirror?: boolean; reversed?: boolean; - label?: string | number | React.ReactElement; + label?: string | number | React.ReactElement | YLabel; scale?: ScaleType | RechartsFunction; unit?: string | number; name?: string | number; From b272cbc7fb000fffbf0752573f4c8b58ea7fec49 Mon Sep 17 00:00:00 2001 From: Roy Xue Date: Thu, 14 Sep 2017 17:10:00 -0700 Subject: [PATCH 2/3] Add contribution name --- types/recharts/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 1e4431ed71..b447eb0b14 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -2,6 +2,7 @@ // Project: http://recharts.org/ // Definitions by: Maarten Mulders // Raphael Mueller +// Roy Xue // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 0ac64e3a4b71b9084ed2eb255265f9aeedefabd0 Mon Sep 17 00:00:00 2001 From: Roy Xue Date: Fri, 15 Sep 2017 10:44:51 -0700 Subject: [PATCH 3/3] Update Label type --- types/recharts/index.d.ts | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index b447eb0b14..fc5eaa664a 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -15,6 +15,8 @@ export type LegendType = 'line' | 'square' | 'rect' | 'circle' | 'cross' | 'diam export type LayoutType = 'horizontal' | 'vertical'; export type AnimationEasingType = 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'; export type ScaleType = 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utcTime' | 'sequential' | 'threshold'; +export type PositionType = 'top' | 'left' | 'right' | 'bottom' | 'inside' | 'outside'| 'insideLeft' | 'insideRight' | + 'insideTop' | 'insideBottom' | 'insideTopLeft' | 'insideBottomLeft' | 'insideTopRight' | 'insideBottomRight' | 'insideStart' | 'insideEnd' | 'end' | 'center'; export interface Margin { top: number; @@ -709,19 +711,23 @@ export interface TreemapProps { animationEasing?: AnimationEasingType; } +export interface Label { + viewBox?: any; + formatter?: RechartsFunction; + value: string | number; + position?: PositionType; + offset?: number; + content?: React.ReactElement | RechartsFunction; + chilren: any; +} + export class Treemap extends React.Component { } export interface XPadding { left: number; right: number; } -export interface XLabel { - value: string; - position?: string; - offset?: number; - stroke?: string; - fontSize?: number; -} + export interface XAxisProps { hide?: boolean; dataKey?: string | number; @@ -745,7 +751,7 @@ export interface XAxisProps { tick?: boolean | any | React.ReactElement; mirror?: boolean; reversed?: boolean; - label?: string | number | React.ReactElement | XLabel; + label?: string | number | React.ReactElement | Label; scale?: ScaleType | RechartsFunction; unit?: string | number; name?: string | number; @@ -765,13 +771,6 @@ export interface YPadding { top: number; bottom: number; } -export interface YLabel { - value: string; - position?: string; - offset?: number; - stroke?: string; - fontSize?: number; -} export interface YAxisProps { hide?: boolean; dataKey?: string | number; @@ -795,7 +794,7 @@ export interface YAxisProps { tick?: boolean | any | React.ReactElement; mirror?: boolean; reversed?: boolean; - label?: string | number | React.ReactElement | YLabel; + label?: string | number | React.ReactElement | Label; scale?: ScaleType | RechartsFunction; unit?: string | number; name?: string | number;