forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
1103 lines (978 loc) · 37.6 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for Recharts 1.8
// Project: http://recharts.org/, https://github.com/recharts/recharts
// Definitions by: Raphael Mueller <https://github.com/rapmue>
// Roy Xue <https://github.com/royxue>
// 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>
// Jamie Saunders <https://github.com/jrsaunde>
// Harry Cruse <https://github.com/crusectrl>
// Andrew Palugniok <https://github.com/apalugniok>
// Robert Stigsson <https://github.com/RobertStigsson>
// Kosaku Kurino <https://github.com/kousaku-maron>
// Leon Ng <https://github.com/iflp>
// Dave Vedder <https://github.com/veddermatic>
// Konstantin Azizov <https://github.com/g07cha>
// Gonzalo Nicolas D'Elia <https://github.com/gndelia>
// Dimitri Mitropoulos <https://github.com/dimitropoulos>
// Eliot Ball <https://github.com/eliotball>
// Ville Kentta <https://github.com/vkentta>
// Fabien Caylus <https://github.com/fcaylus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
import { getTickValues, getNiceTickValues, getTickValuesFixedDomain } from 'recharts-scale';
import { CurveFactory } from 'd3-shape';
export type Percentage = string;
export type RechartsFunction = (...args: any[]) => void;
export type LegendValueFormatter = (value?: LegendPayload['value'], entry?: LegendPayload, i?: number) => any;
export type TickFormatterFunction = (value: any) => any;
export type TickGeneratorFunction = (noTicksProps: object) => ReadonlyArray<any>;
export type LabelFormatter = (label: string | number) => React.ReactNode;
export type TooltipFormatter = (value: string | number | Array<string | number>, name: string,
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) => string | number | Readonly<[number, number]> | null);
export type IconType = 'plainline' | 'line' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'plainline';
export type LegendType = IconType | 'none';
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 type StackOffsetType = 'sign' | 'expand' | 'none' | 'wiggle' | 'silhouette';
export type LineType =
'basis' | 'basisClosed' | 'basisOpen' | 'linear' | 'linearClosed' | 'natural' |
'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter' | CurveFactory;
export type IfOverflowType = 'hidden' | 'visible' | 'discard' | 'extendDomain';
export type AxisInterval = number | 'preserveStart' | 'preserveEnd' | 'preserveStartEnd';
export type BaseValueType = number | 'auto' | 'dataMin' | 'dataMax';
export type ReferenceLinePosition = 'start' | 'middle' | 'end';
export type PickedCSSStyleDeclarationKeys =
'alignmentBaseline' | 'baselineShift' | 'clip' | 'clipPath' | 'clipRule' | 'color' |
'colorInterpolationFilters' | 'cursor' | 'direction' | 'display' | 'dominantBaseline' |
'fill' | 'fillRule' | 'filter' | 'floodColor' |
'floodOpacity' | 'font' | 'fontFamily' | 'fontStretch' | 'fontStyle' | 'fontVariant' |
'glyphOrientationVertical' | 'letterSpacing' | 'lightingColor' |
'markerEnd' | 'markerMid' | 'markerStart' | 'mask' | 'overflow' | 'pointerEvents' |
'stopColor' | 'strokeDasharray' | 'strokeLinecap' | 'strokeLinejoin' | 'textAnchor' |
'textDecoration' | 'unicodeBidi' | 'visibility' | 'writingMode' | 'transform';
export interface BoxSize {
boxWidth: number;
boxHeight: number;
}
export interface ContainerSize {
containerWidth: number;
containerHeight: number;
}
export interface Point {
x: number;
y: number;
value: number | ReadonlyArray<any>;
}
export interface Margin {
top: number;
right: number;
bottom: number;
left: number;
}
export interface Animatable {
onAnimationStart?: RechartsFunction;
onAnimationEnd?: RechartsFunction;
animationId?: number;
isAnimationActive?: boolean;
isUpdateAnimationActive?: boolean;
animationBegin?: number;
animationDuration?: number;
animationEasing?: AnimationEasingType;
}
export interface CategoricalChartWrapper<L = LayoutType> {
syncId?: string | number;
compact?: boolean;
width?: number;
height?: number;
data?: ReadonlyArray<object>;
layout?: L;
stackOffset?: StackOffsetType;
throttleDelay?: number;
margin?: Partial<Margin>;
barCategoryGap?: number | string;
barGap?: number | string;
barSize?: number | string;
baseValue?: BaseValueType;
maxBarSize?: number;
style?: object;
className?: string;
children?: React.ReactNode | React.ReactNode[];
onClick?: RechartsFunction;
onMouseLeave?: RechartsFunction;
onMouseEnter?: RechartsFunction;
onMouseMove?: RechartsFunction;
onMouseDown?: RechartsFunction;
onMouseUp?: RechartsFunction;
reverseStackOrder?: boolean;
}
export interface EventAttributes {
onClick?: RechartsFunction;
onMouseDown?: RechartsFunction;
onMouseUp?: RechartsFunction;
onMouseOver?: RechartsFunction;
onMouseMove?: RechartsFunction;
onMouseOut?: RechartsFunction;
onMouseEnter?: RechartsFunction;
onMouseLeave?: RechartsFunction;
onTouchEnd?: RechartsFunction;
onTouchMove?: RechartsFunction;
onTouchStart?: RechartsFunction;
onTouchCancel?: RechartsFunction;
}
export interface PresentationAttributes<X = number, Y = number> extends Pick<CSSStyleDeclaration, PickedCSSStyleDeclarationKeys> {
angle: number;
colorInterpolation: string;
colorProfile: string;
colorRendering: string;
fill: string;
fillOpacity: number | string;
fontSize: number | string;
fontSizeAdjust: number | string;
fontWeight: 'normal' | 'bold' | 'bolder' | 'lighter' |
100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 'inherit';
imageRendering: 'auto' | 'optimizeSpeed' | 'optimizeQuality' | 'inherit';
kerning: number | string;
opacity: number | string;
shapeRendering: 'auto' | 'optimizeSpeed' | 'crispEdges' | 'geometricPrecision' | 'inherit';
stopOpacity: number | string;
stroke: number | string;
strokeDashoffset: number | string;
strokeMiterlimit: number | string;
strokeOpacity: number | string;
strokeWidth: number | string;
textRendering: 'auto' | 'optimizeSpeed' | 'optimizeLegibility' | 'geometricPrecision' | 'inherit';
wordSpacing: number | string;
style: object;
width: number;
height: number;
dx: number;
dy: number;
x: X;
y: Y;
r: number;
}
export interface AreaProps extends EventAttributes, Partial<PresentationAttributes>, Animatable {
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).
className?: string;
type?: LineType;
unit?: string | number;
name?: string | number;
xAxisId?: string | number;
yAxisId?: string | number;
xAxis?: object;
yAxis?: object;
stackId?: string | number;
legendType?: LegendType;
connectNulls?: boolean;
activeDot?: boolean | object | React.ReactElement | ContentRenderer<any>;
dot?: boolean | object | React.ReactElement | ContentRenderer<DotProps>;
label?: boolean | object | ContentRenderer<any> | React.ReactElement;
hide?: boolean;
layout?: LayoutType;
baseLine?: number | ReadonlyArray<any>;
isRange?: boolean;
points?: ReadonlyArray<Point>;
id?: string;
}
export class Area extends React.Component<AreaProps> { }
// NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it).
export type AreaChartProps = CategoricalChartWrapper & EventAttributes;
export class AreaChart extends React.Component<AreaChartProps> { }
export interface BarData {
x: number;
y: number;
width: number;
height: number;
radius: number | ReadonlyArray<any>;
value: number | string | ReadonlyArray<any>;
}
export interface BarProps extends EventAttributes, Partial<PresentationAttributes>, Animatable {
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).
className?: string;
fill?: string;
radius?: number | ReadonlyArray<number>;
layout?: LayoutType;
xAxisId?: string | number;
yAxisId?: string | number;
yAxis?: object;
xAxis?: object;
stackId?: string | number;
barSize?: number;
unit?: string | number;
name?: string | number;
legendType?: LegendType;
minPointSize?: number;
maxBarSize?: number;
hide?: boolean;
shape?: React.ReactElement | ContentRenderer<RectangleProps>;
data?: ReadonlyArray<BarData>;
background?: boolean | React.ReactElement | ContentRenderer<any> | object;
// see label section at http://recharts.org/#/en-US/api/Bar
label?: boolean | Label | LabelProps | React.SFC<LabelProps> | React.ReactElement<LabelProps> | ContentRenderer<any>;
id?: string;
}
export class Bar extends React.Component<BarProps> { }
// NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it).
export type BarChartProps = CategoricalChartWrapper & EventAttributes;
export class BarChart extends React.Component<BarChartProps> { }
export interface BrushProps {
className?: string;
fill?: string;
stroke?: string;
x?: number;
y?: number;
width?: number;
height?: number;
travellerWidth?: number;
padding?: Partial<Margin>;
dataKey?: DataKey;
data?: ReadonlyArray<any>;
startIndex?: number;
endIndex?: number;
tickFormatter?: TickFormatterFunction;
children?: React.ReactNode;
onChange?: RechartsFunction;
updateId?: string | number;
gap?: number;
leaveTimeOut?: number;
}
export class Brush extends React.Component<BrushProps> { }
export interface CartesianAxisProps extends EventAttributes, Partial<PresentationAttributes> {
className?: string;
x?: number;
y?: number;
width?: number;
height?: number;
orientation?: 'top' | 'bottom' | 'left' | 'right';
viewBox?: ViewBox;
tick?: boolean | ContentRenderer<any> | object | React.ReactElement;
axisLine?: boolean | object;
tickLine?: boolean | object;
mirror?: boolean;
minTickGap?: number;
ticks?: ReadonlyArray<any>;
tickSize?: number;
stroke?: string;
tickFormatter?: TickFormatterFunction;
ticksGenerator?: TickGeneratorFunction;
interval?: AxisInterval;
}
export class CartesianAxis extends React.Component<CartesianAxisProps> { }
export type CoordinatesGenerator = (arg: {
yAxis: CartesianGridProps['yAxis'];
width: CartesianGridProps['chartWidth'];
height: CartesianGridProps['chartHeight'];
offset: CartesianGridProps['offset'];
}) => ReadonlyArray<number>;
export interface CartesianGridProps extends Partial<PresentationAttributes> {
y?: number;
width?: number;
height?: number;
horizontal?: object | React.ReactElement | ContentRenderer<LineProps & CartesianGridProps> | boolean;
vertical?: object | React.ReactElement | ContentRenderer<LineProps & CartesianGridProps> | boolean;
horizontalPoints?: ReadonlyArray<number>;
verticalPoints?: ReadonlyArray<number>;
horizontalCoordinatesGenerator?: CoordinatesGenerator;
verticalCoordinatesGenerator?: CoordinatesGenerator;
xAxis?: object;
yAxis?: object;
offset?: object;
chartWidth?: number;
chartHeight?: number;
horizontalFill?: ReadonlyArray<string>;
verticalFill?: ReadonlyArray<string>;
}
export class CartesianGrid extends React.Component<CartesianGridProps> { }
export interface CellProps extends Partial<PresentationAttributes> {
onClick?: RechartsFunction;
onMouseEnter?: RechartsFunction;
onMouseLeave?: RechartsFunction;
}
export class Cell extends React.Component<CellProps> { }
// NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it).
export type ComposedChartProps = CategoricalChartWrapper & EventAttributes;
export class ComposedChart extends React.Component<ComposedChartProps> { }
export interface CrossProps extends Partial<PresentationAttributes> {
className?: string;
x?: number;
y?: number;
width?: number;
height?: number;
top?: number;
left?: number;
}
export class Cross extends React.Component<CrossProps> { }
// NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it).
export interface CurveProps extends EventAttributes, Partial<PresentationAttributes> {
className?: string;
type?: LineType;
layout?: LayoutType;
baseLine?: number | ReadonlyArray<any>;
points?: ReadonlyArray<object>;
connectNulls?: boolean;
path?: string;
pathRef?: React.Ref<any>;
}
export class Curve extends React.Component<CurveProps> { }
// NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it).
export interface DotProps extends EventAttributes {
className?: string;
cx?: number;
cy?: number;
r?: number;
}
export class Dot extends React.Component<DotProps> { }
export type DataPointFormatter = (entry: any, dataKey: DataKey) => { x: number; y: number, value: any; errorVal: any; };
export interface ErrorBarProps {
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).
data?: ReadonlyArray<any>;
xAxis?: object;
yAxis?: object;
layout?: string;
dataPointFormatter?: DataPointFormatter;
stroke?: string;
strokeWidth?: number;
width?: number;
offset?: number;
}
export class ErrorBar extends React.Component<ErrorBarProps> { }
export interface LegendPayload {
value: any;
id: any;
type: LegendType;
color?: string;
}
export type BBoxUpdateCallback = (box: { width: number; height: number; }) => void;
export interface LegendProps {
content?: React.ReactElement | ContentRenderer<LegendProps>;
wrapperStyle?: object;
chartWidth?: number;
chartHeight?: number;
width?: number;
height?: number;
iconSize?: number;
iconType?: IconType;
layout?: LayoutType;
align?: 'left' | 'center' | 'right';
verticalAlign?: 'top' | 'middle' | 'bottom';
margin?: Partial<Margin>;
payload?: ReadonlyArray<LegendPayload>;
formatter?: LegendValueFormatter;
onClick?: RechartsFunction;
onMouseEnter?: RechartsFunction;
onMouseLeave?: RechartsFunction;
onBBoxUpdate?: BBoxUpdateCallback;
}
export class Legend extends React.Component<LegendProps, BoxSize> { }
export interface LineProps extends EventAttributes, Partial<PresentationAttributes>, Animatable {
className?: string;
type?: LineType;
unit?: string | number;
name?: string | number;
xAxisId?: string | number;
yAxisId?: string | number;
yAxis?: object;
xAxis?: object;
legendType?: LegendType;
layout?: LayoutType;
connectNulls?: boolean;
hide?: boolean;
activeDot?: object | React.ReactElement | ContentRenderer<any> | boolean;
dot?: object | React.ReactElement | ContentRenderer<DotProps> | boolean;
top?: number;
left?: number;
width?: number;
height?: number;
data?: ReadonlyArray<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 | ContentRenderer<any>;
points?: ReadonlyArray<Point>;
id?: string;
}
export class Line extends React.Component<LineProps> { }
// NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it).
export type LineChartProps = CategoricalChartWrapper & EventAttributes;
export class LineChart extends React.Component<LineChartProps> { }
export interface PieProps extends EventAttributes, Partial<PresentationAttributes>, Animatable {
className?: string;
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).
cx?: number | string;
cy?: number | string;
startAngle?: number;
endAngle?: number;
midAngle?: number;
paddingAngle?: number;
innerRadius?: number | string;
outerRadius?: number | string;
cornerRadius?: number | string;
nameKey?: string | number | ((dataObject: any) => number);
valueKey?: string | number | ((dataObject: any) => number);
data?: ReadonlyArray<object>;
minAngle?: number;
legendType?: LegendType;
maxRadius?: number;
sectors?: ReadonlyArray<object>;
hide?: boolean;
labelLine?: object | ContentRenderer<LineProps & any> | React.ReactElement | boolean;
label?: {
offsetRadius: number;
} | React.ReactElement | ContentRenderer<PieLabelRenderProps> | boolean;
activeShape?: object | ContentRenderer<any> | React.ReactElement;
activeIndex?: number | ReadonlyArray<number>;
blendStroke?: boolean;
}
export interface PieLabelRenderProps extends PieProps {
name: string;
percent?: number;
stroke: string;
index?: number;
textAnchor: string;
x: number;
y: number;
[key: string]: any;
}
export class Pie extends React.Component<PieProps> { }
// NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it).
export interface PieChartProps extends EventAttributes, CategoricalChartWrapper<'centric'> {
startAngle?: number;
endAngle?: number;
cx?: number | string;
cy?: number | string;
innerRadius?: number | string;
outerRadius?: number | string;
}
export class PieChart extends React.Component<PieChartProps> { }
export interface PolarAngleAxisTick {
value: any;
coordinate: number;
}
export interface PolarAngleAxisProps extends EventAttributes, Partial<PresentationAttributes> {
type?: 'number' | 'category';
angleAxisId?: string | 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).
cx?: number;
cy?: number;
radius?: Percentage | number;
hide?: boolean;
scale?: ScaleType | RechartsFunction; // this seems not being used by the lib.
axisLine?: boolean | object;
axisLineType?: 'polygon' | 'circle';
tickLine?: boolean | object;
tick?: boolean | ContentRenderer<any> | object | React.ReactElement;
ticks?: ReadonlyArray<PolarAngleAxisTick>;
stroke?: string;
orientation?: 'inner' | 'outer';
tickFormatter?: TickFormatterFunction;
}
export class PolarAngleAxis extends React.Component<PolarAngleAxisProps> { }
export interface PolarGridProps extends Partial<PresentationAttributes> {
cx?: number;
cy?: number;
innerRadius?: number;
outerRadius?: number;
polarAngles?: ReadonlyArray<number>;
polarRadius?: ReadonlyArray<number>;
gridType?: 'polygon' | 'circle';
}
export class PolarGrid extends React.Component<PolarGridProps> { }
export interface PolarRadiusAxisTick {
value: any;
coordinate: number;
}
export type PolarRadiusAxisDomain = number | 'auto' | 'dataMin' | 'dataMax';
export interface PolarRadiusAxisProps extends EventAttributes, Partial<PresentationAttributes> {
type?: 'number' | 'category';
cx?: number;
cy?: number;
hide?: boolean;
radiusAxisId?: string | number;
angle?: number;
tickCount?: number;
ticks?: ReadonlyArray<PolarRadiusAxisTick>;
orientation?: "left" | "right" | "middle";
axisLine?: boolean | object;
tick?: boolean | object | React.ReactElement | ContentRenderer<any>;
stroke?: string;
tickFormatter?: TickFormatterFunction;
domain?: Readonly<[PolarRadiusAxisDomain, PolarRadiusAxisDomain]>;
scale?: ScaleType | RechartsFunction;
allowDataOverflow?: boolean;
}
export class PolarRadiusAxis extends React.Component<PolarRadiusAxisProps> { }
export interface PolygonPoint {
x: number;
y: number;
}
export interface PolygonProps extends EventAttributes, Partial<PresentationAttributes> {
className?: string;
points?: ReadonlyArray<PolygonPoint>;
}
export class Polygon extends React.Component<PolygonProps> { }
export interface RadarPoint {
x: number;
y: number;
cx: number;
cy: number;
angle: number;
radius: number;
value: number;
payload: object;
}
export interface RadarProps extends EventAttributes, Partial<PresentationAttributes>, Animatable {
className?: string;
name?: string;
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).
points?: ReadonlyArray<RadarPoint>;
shape?: React.ReactElement | ContentRenderer<RadarProps>;
activeDot?: object | React.ReactElement | ContentRenderer<any> | boolean;
dot?: object | React.ReactElement | ContentRenderer<DotProps> | boolean;
label?: object | React.ReactElement | ContentRenderer<any> | boolean;
legendType?: LegendType;
hide?: boolean;
}
export class Radar extends React.Component<RadarProps> { }
// NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it).
export interface RadarChartProps extends EventAttributes, CategoricalChartWrapper<'centric'> {
startAngle?: number;
endAngle?: number;
cx?: number | string;
cy?: number | string;
innerRadius?: number | string;
outerRadius?: number | string;
}
export class RadarChart extends React.Component<RadarChartProps> { }
export interface RadialBarData {
cx: number;
cy: number;
innerRadius: number;
outerRadius: number;
value: any;
}
export interface RadialBarProps extends EventAttributes, Partial<PresentationAttributes>, Animatable {
className?: string;
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).
angleAxisId?: string | number;
radiusAxisId?: string | number;
shape?: ContentRenderer<any> | React.ReactElement;
activeShape?: object | ContentRenderer<any> | React.ReactElement;
cornerRadius?: number | string;
minPointSize?: number;
maxBarSize?: number;
data?: ReadonlyArray<RadialBarData>;
legendType?: LegendType;
label?: boolean | React.ReactElement | ContentRenderer<any> | object;
background?: boolean | React.ReactElement | ContentRenderer<any> | object;
hide?: boolean;
}
export class RadialBar extends React.Component<RadialBarProps> { }
export interface RadialBarChartProps extends CategoricalChartWrapper<'radial'> {
startAngle?: number;
endAngle?: number;
cx?: string | number;
cy?: string | number;
innerRadius?: string | number;
outerRadius?: string | number;
}
export class RadialBarChart extends React.Component<RadialBarChartProps> { }
export interface RectangleProps extends EventAttributes, Partial<PresentationAttributes>, Animatable {
className?: string;
x?: number;
y?: number;
width?: number;
height?: number;
radius?: number | ReadonlyArray<any>;
}
export class Rectangle extends React.Component<RectangleProps> { }
export interface ReferenceAreaProps extends Partial<PresentationAttributes> {
className?: number | string;
viewBox?: ViewBox;
xAxis?: object;
yAxis?: object;
isFront?: boolean;
alwaysShow?: boolean;
ifOverflow?: IfOverflowType;
x1?: number | string;
x2?: number | string;
y1?: number | string;
y2?: number | string;
xAxisId?: string | number;
yAxisId?: string | number;
shape?: ContentRenderer<ReferenceAreaProps & RectangleProps> | React.ReactElement;
}
export class ReferenceArea extends React.Component<ReferenceAreaProps> { }
export type ScaleCalculator = (x: number | string) => number;
export interface ReferenceDotAxisConfiguration {
scale: ScaleCalculator;
}
export interface ReferenceDotProps extends EventAttributes, Partial<PresentationAttributes<number | string, number | string>> {
className?: number | string;
r?: number;
xAxis?: ReferenceDotAxisConfiguration;
yAxis?: ReferenceDotAxisConfiguration;
isFront?: boolean;
alwaysShow?: boolean;
ifOverflow?: IfOverflowType;
x?: number | string;
y?: number | string;
xAxisId?: string | number;
yAxisId?: string | number;
shape?: ContentRenderer<
EventAttributes
& Partial<PresentationAttributes<number | string, number | string>>
& { cx: number; cy: number; }
> | React.ReactElement;
label?: string | number | React.ReactElement | RechartsFunction;
}
export class ReferenceDot extends React.Component<ReferenceDotProps> { }
export interface SegmentItem {
x: number | string;
y: number | string;
}
export interface ReferenceLineProps extends Partial<PresentationAttributes<number | string, number | string>> {
className?: number | string;
viewBox?: ViewBox;
xAxis?: object;
yAxis?: object;
isFront?: boolean;
alwaysShow?: boolean;
ifOverflow?: IfOverflowType;
x?: number | string;
y?: number | string;
segment?: Readonly<[SegmentItem, SegmentItem]>;
label?: string | number | ContentRenderer<any> | React.ReactElement;
xAxisId?: string | number;
yAxisId?: string | number;
shape?: ContentRenderer<
EventAttributes
& Partial<PresentationAttributes<number | string, number | string>>
& { x1: number; y1: number; x2: number; y2: number; }
> | React.ReactElement;
position?: ReferenceLinePosition;
}
export class ReferenceLine extends React.Component<ReferenceLineProps> { }
export interface ResponsiveContainerProps {
aspect?: number;
width?: string | number;
height?: string | number;
minHeight?: string | number;
minWidth?: string | number;
maxHeight?: string | number;
children: React.ReactNode;
debounce?: number;
id?: string | number;
className?: string | number;
}
export class ResponsiveContainer extends React.Component<ResponsiveContainerProps, ContainerSize> { }
export interface ScatterPoint {
cx?: number;
cy?: number;
size?: number;
node?: {
x?: number | string;
y?: number | string;
z?: number | string;
};
payload?: any;
}
export interface ScatterProps extends EventAttributes, Partial<PresentationAttributes>, Animatable {
xAxisId?: string | number;
yAxisId?: string | number;
zAxisId?: string | number;
line?: boolean | object | RechartsFunction | React.ReactElement;
lineType?: 'joint' | 'fitting';
lineJointType?: LineType;
legendType?: LegendType;
activeIndex?: number;
activeShape?: object | RechartsFunction | React.ReactElement;
shape?: 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | React.ReactElement | ContentRenderer<any>;
points?: ReadonlyArray<ScatterPoint>;
hide?: boolean;
data?: ReadonlyArray<object>;
dataKey?: DataKey;
name?: string | number;
id?: string;
}
export class Scatter extends React.Component<ScatterProps> { }
// NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it).
export type ScatterChartProps = CategoricalChartWrapper & EventAttributes;
export class ScatterChart extends React.Component<ScatterChartProps> { }
export interface SectorProps extends EventAttributes, Partial<PresentationAttributes> {
className?: string;
cx?: number;
cy?: number;
innerRadius?: number;
outerRadius?: number;
startAngle?: number;
endAngle?: number;
cornerRadius?: number | string;
}
export class Sector extends React.Component<SectorProps> { }
export interface TextProps extends Partial<PresentationAttributes> {
className?: string;
scaleToFit?: boolean;
angle?: number;
textAnchor?: 'start' | 'middle' | 'end' | 'inherit';
verticalAnchor?: 'start' | 'middle' | 'end';
style?: object;
capHeight?: string;
lineHeight?: string;
}
export class Text extends React.Component<TextProps> { }
export interface ViewBox {
x?: number;
y?: number;
width?: number;
height?: number;
}
export interface PolarViewBox {
cx?: number;
cy?: number;
innerRadius?: number;
outerRadius?: number;
startAngle?: number;
endAngle?: number;
}
export interface Coordinate {
x: number;
y: number;
}
export type AllowEscapeViewBox = { x: boolean } | { y: boolean } | { x: boolean, y: boolean };
export interface TooltipPayload {
name: string;
value: string | number | ReadonlyArray<(string | number)>;
unit?: string;
color?: string;
fill?: string;
dataKey?: DataKey;
formatter?: TooltipFormatter;
payload?: any;
}
export interface TooltipProps extends Animatable {
content?: React.ReactElement | React.StatelessComponent<any> | ContentRenderer<TooltipProps>;
viewBox?: ViewBox;
allowEscapeViewBox?: AllowEscapeViewBox;
active?: boolean;
separator?: string;
formatter?: TooltipFormatter;
offset?: number;
itemStyle?: object;
labelStyle?: object;
contentStyle?: object;
wrapperStyle?: object;
cursor?: boolean | object | React.ReactElement | React.StatelessComponent<any>;
coordinate?: Coordinate;
position?: Coordinate;
label?: string | number;
labelFormatter?: LabelFormatter;
payload?: ReadonlyArray<TooltipPayload>;
itemSorter?: ItemSorter<TooltipPayload>;
filterNull?: boolean;
useTranslate3d?: boolean;
}
export class Tooltip extends React.Component<TooltipProps, BoxSize> { }
export interface TreemapProps extends EventAttributes, Animatable {
width?: number;
height?: number;
data?: ReadonlyArray<any>;
style?: object;
aspectRatio?: number;
content?: React.ReactElement | ContentRenderer<any>;
fill?: string;
stroke?: string;
className?: string;
nameKey?: string | number | RechartsFunction;
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).
children?: React.ReactNode[] | React.ReactNode;
}
export class Treemap extends React.Component<TreemapProps> { }
export class Label extends React.Component<LabelProps> { }
export interface LabelProps extends Partial<PresentationAttributes> {
angle?: number;
viewBox?: ViewBox | PolarViewBox;
formatter?: LabelFormatter;
value?: number | string;
offset?: number;
position?: PositionType;
children?: React.ReactNode[] | React.ReactNode;
className?: string;
content?: React.ReactElement | ContentRenderer<any>;
}
export class LabelList extends React.Component<LabelListProps> { }
export type LabelListProps = {
angle?: number;
children?: React.ReactNode[] | React.ReactNode;
className?: string;
clockWise?: boolean;
content?: React.ReactElement | ContentRenderer<LabelProps>;
data?: number;
formatter?: LabelFormatter;
id?: string;
offset?: number;
position?: PositionType;
} & ({ dataKey: string | number | RechartsFunction, valueAccessor?: never } | { valueAccessor: RechartsFunction, dataKey?: never });
export type AxisDomain = string | number | ContentRenderer<any> | 'auto' | 'dataMin' | 'dataMax';
export interface XPadding {
left: number;
right: number;
}
/**
* In the current lib, there is not actual implementation for XAxis.
*/
// NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it).
export interface XAxisProps extends EventAttributes {
allowDecimals?: boolean;
hide?: boolean;
// The name of data displayed in the axis
name?: string | number;
// The unit of data displayed in the axis
unit?: string | number;
// The unique id of x-axis
xAxisId?: string | number;
domain?: Readonly<[AxisDomain, AxisDomain]>;
// The key of data displayed in the axis
dataKey?: DataKey;
// The width of axis which is usually calculated internally
width?: number;
// The height of axis, which need to be set by user
height?: number;
// Rotation of tick labels
angle?: number;
// X offset of tick label
dx?: number;
// Y offset of tick label
dy?: number;
mirror?: boolean;
// The orientation of axis
orientation?: 'top' | 'bottom';
type?: 'number' | 'category';
// Ticks can be any type when the axis is the type of category
// Ticks must be numbers when the axis is the type of number
ticks?: ReadonlyArray<any>;
// The count of ticks
tickCount?: number;
// The formatter function of tick
tickFormatter?: TickFormatterFunction;
padding?: XPadding;
allowDataOverflow?: boolean;
scale?: ScaleType | RechartsFunction;
tick?: boolean | ContentRenderer<any> | object | React.ReactElement;
axisLine?: boolean | object;
tickLine?: boolean | object;
minTickGap?: number;
tickSize?: number;
// The margin between tick line and the label
tickMargin?: number;
interval?: AxisInterval;
textAnchor?: string;
reversed?: boolean;
// see label section at http://recharts.org/#/en-US/api/XAxis
label?: string | number | Label | LabelProps;
allowDuplicatedCategory?: boolean;
stroke?: string;
}
export class XAxis extends React.Component<XAxisProps> { }