@octanejs/recharts 0.1.62 → 0.1.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/animation/AnimatedItems.tsrx +36 -31
- package/src/animation/CSSTransitionAnimate.tsrx +1 -2
- package/src/animation/JavascriptAnimate.tsrx +1 -2
- package/src/cartesian/Area.tsrx +414 -386
- package/src/cartesian/AreaRevealShape.tsrx +103 -84
- package/src/cartesian/Bar.tsrx +343 -317
- package/src/cartesian/BarStack.tsrx +33 -28
- package/src/cartesian/CartesianAxis.tsrx +168 -165
- package/src/cartesian/CartesianGrid.tsrx +256 -272
- package/src/cartesian/ErrorBar.tsrx +108 -104
- package/src/cartesian/Funnel.tsrx +405 -382
- package/src/cartesian/GraphicalItemClipPath.tsrx +4 -8
- package/src/cartesian/Line.tsrx +190 -177
- package/src/cartesian/LineDrawShape.tsrx +14 -15
- package/src/cartesian/ReferenceLine.tsrx +119 -105
- package/src/cartesian/Scatter.tsrx +416 -398
- package/src/cartesian/XAxis.tsrx +39 -32
- package/src/cartesian/YAxis.tsrx +47 -37
- package/src/cartesian/ZAxis.tsrx +76 -73
- package/src/chart/AreaChart.tsrx +15 -11
- package/src/chart/BarChart.tsrx +15 -11
- package/src/chart/CategoricalChart.tsrx +32 -26
- package/src/chart/ComposedChart.tsrx +15 -11
- package/src/chart/FunnelChart.tsrx +15 -11
- package/src/chart/LineChart.tsrx +15 -11
- package/src/chart/PieChart.tsrx +15 -11
- package/src/chart/PolarChart.tsrx +45 -48
- package/src/chart/RadarChart.tsrx +38 -32
- package/src/chart/RadialBarChart.tsrx +15 -11
- package/src/chart/RechartsWrapper.tsrx +214 -162
- package/src/chart/Sankey.tsrx +412 -378
- package/src/chart/ScatterChart.tsrx +15 -11
- package/src/chart/SunburstChart.tsrx +162 -155
- package/src/component/ActivePoints.tsrx +19 -13
- package/src/component/Cursor.tsrx +25 -18
- package/src/component/DefaultLegendContent.tsrx +131 -127
- package/src/component/DefaultTooltipContent.tsrx +46 -42
- package/src/component/Dots.tsrx +11 -5
- package/src/component/Label.tsrx +69 -55
- package/src/component/LabelList.tsrx +32 -27
- package/src/component/Legend.tsrx +120 -123
- package/src/component/ResponsiveContainer.tsrx +18 -11
- package/src/component/Text.tsrx +50 -43
- package/src/component/Tooltip.tsrx +234 -223
- package/src/component/TooltipBoundingBox.tsrx +34 -34
- package/src/container/ClipPathProvider.tsrx +1 -3
- package/src/container/Layer.tsrx +5 -1
- package/src/container/RootSurface.tsrx +31 -21
- package/src/container/Surface.tsrx +15 -13
- package/src/context/ErrorBarContext.tsrx +5 -5
- package/src/polar/Pie.tsrx +541 -487
- package/src/polar/PolarAngleAxis.tsrx +245 -227
- package/src/polar/PolarGrid.tsrx +139 -127
- package/src/polar/PolarRadiusAxis.tsrx +204 -185
- package/src/polar/Radar.tsrx +274 -264
- package/src/polar/RadialBar.tsrx +408 -361
- package/src/shape/Cross.tsrx +13 -7
- package/src/shape/Curve.tsrx +54 -44
- package/src/shape/Dot.tsrx +10 -8
- package/src/shape/Polygon.tsrx +38 -29
- package/src/shape/Rectangle.tsrx +73 -28
- package/src/shape/Sector.tsrx +30 -18
- package/src/shape/Symbols.tsrx +13 -11
- package/src/shape/Trapezoid.tsrx +16 -11
- package/src/state/RechartsStoreProvider.tsrx +5 -1
- package/src/synchronisation/useChartSynchronisation.tsrx +8 -7
- package/src/util/BarUtils.tsrx +43 -40
- package/src/util/FunnelUtils.tsrx +5 -5
- package/src/util/RadialBarUtils.tsrx +3 -4
- package/src/util/ScatterUtils.tsrx +13 -8
- package/src/zIndex/ZIndexLayer.tsrx +2 -2
- package/src/zIndex/ZIndexPortal.tsrx +2 -8
package/src/polar/PolarGrid.tsrx
CHANGED
|
@@ -14,116 +14,114 @@ import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
|
14
14
|
|
|
15
15
|
interface PolarGridProps extends ZIndexable {
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
* The x-coordinate of center.
|
|
18
|
+
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
|
|
19
|
+
* and this prop is ignored.
|
|
20
|
+
*
|
|
21
|
+
* This is only used when rendered outside a chart context.
|
|
22
|
+
*/
|
|
23
23
|
cx?: number;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
* The y-coordinate of center.
|
|
26
|
+
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
|
|
27
|
+
* and this prop is ignored.
|
|
28
|
+
*
|
|
29
|
+
* This is only used when rendered outside a chart context.
|
|
30
|
+
*/
|
|
31
31
|
cy?: number;
|
|
32
32
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
* The radius of the inner polar grid.
|
|
34
|
+
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
|
|
35
|
+
* and this prop is ignored.
|
|
36
|
+
*
|
|
37
|
+
* This is only used when rendered outside a chart context.
|
|
38
|
+
*/
|
|
39
39
|
innerRadius?: number;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
* The radius of the outer polar grid.
|
|
42
|
+
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
|
|
43
|
+
* and this prop is ignored.
|
|
44
|
+
*
|
|
45
|
+
* This is only used when rendered outside a chart context.
|
|
46
|
+
*/
|
|
47
47
|
outerRadius?: number;
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
* The array of every line grid's angle.
|
|
50
|
+
*/
|
|
51
51
|
polarAngles?: ReadonlyArray<number>;
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
* The array of every circle grid's radius.
|
|
54
|
+
*/
|
|
55
55
|
polarRadius?: ReadonlyArray<number>;
|
|
56
56
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
* The type of polar grids.
|
|
58
|
+
* @defaultValue polygon
|
|
59
|
+
*/
|
|
60
60
|
gridType?: 'polygon' | 'circle';
|
|
61
61
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
* @defaultValue true
|
|
63
|
+
*/
|
|
64
64
|
radialLines?: boolean;
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
* @defaultValue 0
|
|
67
|
+
*/
|
|
68
68
|
angleAxisId?: AxisId;
|
|
69
69
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
* @defaultValue 0
|
|
71
|
+
*/
|
|
72
72
|
radiusAxisId?: AxisId;
|
|
73
73
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
* Z-Index of this component and its children. The higher the value,
|
|
75
|
+
* the more on top it will be rendered.
|
|
76
|
+
* Components with higher zIndex will appear in front of components with lower zIndex.
|
|
77
|
+
* If undefined or 0, the content is rendered in the default layer without portals.
|
|
78
|
+
*
|
|
79
|
+
* @since 3.4
|
|
80
|
+
* @defaultValue -100
|
|
81
|
+
* @see {@link https://recharts.github.io/en-US/guide/zIndex/ Z-Index and layers guide}
|
|
82
|
+
*/
|
|
83
83
|
zIndex?: number;
|
|
84
84
|
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
* The stroke color. If "none", no line will be drawn.
|
|
86
|
+
* @defaultValue #ccc
|
|
87
|
+
*/
|
|
88
88
|
stroke?: string;
|
|
89
89
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
* The width of the stroke.
|
|
91
|
+
* @defaultValue 1
|
|
92
|
+
*/
|
|
93
93
|
strokeWidth?: number | string;
|
|
94
94
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
* The pattern of dashes and gaps used to paint the lines of the grid.
|
|
96
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray stroke-dasharray on MDN}
|
|
97
|
+
*/
|
|
98
98
|
strokeDasharray?: string | number;
|
|
99
99
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
* The background color used to fill the space between grid lines.
|
|
101
|
+
* @defaultValue none
|
|
102
|
+
*/
|
|
103
103
|
fill?: string;
|
|
104
104
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
* The opacity of the background used to fill the space between grid lines.
|
|
106
|
+
*/
|
|
107
107
|
fillOpacity?: number | string;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
export type Props = Omit<SVGProps<SVGLineElement>, 'ref'> & PolarGridProps;
|
|
111
111
|
|
|
112
|
-
type PropsWithDefaults =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
};
|
|
112
|
+
type PropsWithDefaults = Props & {
|
|
113
|
+
cx: number;
|
|
114
|
+
cy: number;
|
|
115
|
+
innerRadius: number;
|
|
116
|
+
outerRadius: number;
|
|
117
|
+
polarAngles: ReadonlyArray<number>;
|
|
118
|
+
polarRadius: ReadonlyArray<number>;
|
|
119
|
+
};
|
|
121
120
|
|
|
122
|
-
type ConcentricProps =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
121
|
+
type ConcentricProps = PropsWithDefaults & {
|
|
122
|
+
// The radius of circle
|
|
123
|
+
radius: number;
|
|
124
|
+
};
|
|
127
125
|
|
|
128
126
|
const getPolygonPath = (
|
|
129
127
|
radius: number,
|
|
@@ -158,19 +156,25 @@ const PolarAngles: FunctionComponent<PropsWithDefaults> = (props: PropsWithDefau
|
|
|
158
156
|
...svgPropertiesNoEvents(props),
|
|
159
157
|
};
|
|
160
158
|
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
159
|
+
return (
|
|
160
|
+
<g className="recharts-polar-grid-angle">
|
|
161
|
+
{polarAngles.map((entry) => {
|
|
162
|
+
const start = polarToCartesian(cx, cy, innerRadius, entry);
|
|
163
|
+
const end = polarToCartesian(cx, cy, outerRadius, entry);
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<line
|
|
167
|
+
key={`line-${entry}`}
|
|
168
|
+
{...polarAnglesProps}
|
|
169
|
+
x1={start.x}
|
|
170
|
+
y1={start.y}
|
|
171
|
+
x2={end.x}
|
|
172
|
+
y2={end.y}
|
|
173
|
+
/>
|
|
174
|
+
);
|
|
175
|
+
})}
|
|
176
|
+
</g>
|
|
177
|
+
);
|
|
174
178
|
};
|
|
175
179
|
|
|
176
180
|
// Draw concentric circles
|
|
@@ -199,11 +203,13 @@ const ConcentricPolygon: FunctionComponent<ConcentricProps> = (props: Concentric
|
|
|
199
203
|
...svgPropertiesNoEvents(props),
|
|
200
204
|
};
|
|
201
205
|
|
|
202
|
-
return
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
206
|
+
return (
|
|
207
|
+
<path
|
|
208
|
+
{...concentricPolygonProps}
|
|
209
|
+
className={clsx('recharts-polar-grid-concentric-polygon', props.className)}
|
|
210
|
+
d={getPolygonPath(radius, props.cx, props.cy, props.polarAngles)}
|
|
211
|
+
/>
|
|
212
|
+
);
|
|
207
213
|
};
|
|
208
214
|
|
|
209
215
|
// Draw concentric axis
|
|
@@ -217,23 +223,27 @@ const ConcentricGridPath = (props: PropsWithDefaults) => {
|
|
|
217
223
|
const maxPolarRadius: number = Math.max(...polarRadius);
|
|
218
224
|
const renderBackground = props.fill && props.fill !== 'none';
|
|
219
225
|
|
|
220
|
-
return
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
226
|
+
return (
|
|
227
|
+
<g className="recharts-polar-grid-concentric">
|
|
228
|
+
{/* Render background as separate first child to do not cover strokes of smaller figures */}
|
|
229
|
+
{renderBackground && gridType === 'circle' && (
|
|
230
|
+
<ConcentricCircle {...props} radius={maxPolarRadius} />
|
|
231
|
+
)}
|
|
232
|
+
{renderBackground && gridType !== 'circle' && (
|
|
233
|
+
<ConcentricPolygon {...props} radius={maxPolarRadius} />
|
|
234
|
+
)}
|
|
235
|
+
|
|
236
|
+
{polarRadius.map((entry: number, i: number) => {
|
|
237
|
+
const key = i;
|
|
238
|
+
|
|
239
|
+
if (gridType === 'circle') {
|
|
240
|
+
return <ConcentricCircle key={key} {...props} fill="none" radius={entry} />;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return <ConcentricPolygon key={key} {...props} fill="none" radius={entry} />;
|
|
244
|
+
})}
|
|
245
|
+
</g>
|
|
246
|
+
);
|
|
237
247
|
};
|
|
238
248
|
|
|
239
249
|
export const defaultPolarGridProps = {
|
|
@@ -294,24 +304,26 @@ export const PolarGrid = (outsideProps: Props) => {
|
|
|
294
304
|
return null;
|
|
295
305
|
}
|
|
296
306
|
|
|
297
|
-
return
|
|
298
|
-
<
|
|
299
|
-
<
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
307
|
+
return (
|
|
308
|
+
<ZIndexLayer zIndex={props.zIndex}>
|
|
309
|
+
<g className="recharts-polar-grid">
|
|
310
|
+
<ConcentricGridPath
|
|
311
|
+
gridType={gridType}
|
|
312
|
+
radialLines={radialLines}
|
|
313
|
+
{...props}
|
|
314
|
+
polarAngles={polarAngles}
|
|
315
|
+
polarRadius={polarRadius}
|
|
316
|
+
/>
|
|
317
|
+
<PolarAngles
|
|
318
|
+
gridType={gridType}
|
|
319
|
+
radialLines={radialLines}
|
|
320
|
+
{...props}
|
|
321
|
+
polarAngles={polarAngles}
|
|
322
|
+
polarRadius={polarRadius}
|
|
323
|
+
/>
|
|
324
|
+
</g>
|
|
325
|
+
</ZIndexLayer>
|
|
326
|
+
);
|
|
315
327
|
};
|
|
316
328
|
|
|
317
329
|
PolarGrid.displayName = 'PolarGrid';
|