@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
|
@@ -53,245 +53,248 @@ import { getClassNameFromUnknown } from '../util/getClassNameFromUnknown';
|
|
|
53
53
|
const eps = 1e-5;
|
|
54
54
|
const COS_45 = Math.cos(degreeToRadian(45));
|
|
55
55
|
|
|
56
|
-
export interface PolarAngleAxisProps<DataPointType = any, DataValueType = any>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
>,
|
|
56
|
+
export interface PolarAngleAxisProps<DataPointType = any, DataValueType = any>
|
|
57
|
+
extends
|
|
58
|
+
Omit<
|
|
59
|
+
RenderableAxisProps<DataPointType, DataValueType>,
|
|
60
|
+
'axisLine' | 'tickCount' | 'domain' | 'scale' | 'tick'
|
|
61
|
+
>,
|
|
62
|
+
ZIndexable {
|
|
60
63
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
* Controls axis line element. These are be passed as props to SVG `<line>` element representing the axis line.
|
|
65
|
+
* If `true` then the axis line is drawn using props of the PolarAngleAxis component.
|
|
66
|
+
* If `false` then the axis line is not drawn.
|
|
67
|
+
*
|
|
68
|
+
* Also see `axisLineType` prop to change the shape of the axis line.
|
|
69
|
+
*
|
|
70
|
+
* @defaultValue true
|
|
71
|
+
*
|
|
72
|
+
* @example <PolarAngleAxis axisLine={{ stroke: 'red', strokeWidth: 2 }} />
|
|
73
|
+
* @example <PolarAngleAxis axisLine={false} />
|
|
74
|
+
* @example <PolarAngleAxis stroke='red' strokeWidth={2} strokeDasharray={4} />
|
|
75
|
+
*/
|
|
73
76
|
axisLine?: boolean | SVGProps<SVGCircleElement | SVGPathElement>;
|
|
74
77
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
* @defaultValue false
|
|
79
|
+
*/
|
|
77
80
|
allowDecimals?: boolean;
|
|
78
81
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
* Allow the axis has duplicated categories or not when the type of axis is "category".
|
|
83
|
+
* @defaultValue true
|
|
84
|
+
*/
|
|
82
85
|
allowDuplicatedCategory?: boolean;
|
|
83
86
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
* @defaultValue 0
|
|
88
|
+
*/
|
|
86
89
|
angleAxisId?: string | number;
|
|
87
90
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
* The type of axis line.
|
|
92
|
+
* @defaultValue polygon
|
|
93
|
+
*/
|
|
91
94
|
axisLineType?: 'polygon' | 'circle';
|
|
92
95
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
* The x-coordinate of center.
|
|
97
|
+
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
|
|
98
|
+
* and this prop is ignored.
|
|
99
|
+
*
|
|
100
|
+
* This is only used when rendered outside a chart context.
|
|
101
|
+
*/
|
|
99
102
|
cx?: number;
|
|
100
103
|
/**
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
* The y-coordinate of center.
|
|
105
|
+
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
|
|
106
|
+
* and this prop is ignored.
|
|
107
|
+
*
|
|
108
|
+
* This is only used when rendered outside a chart context.
|
|
109
|
+
*/
|
|
107
110
|
cy?: number;
|
|
108
111
|
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
* The orientation of axis text.
|
|
113
|
+
* @defaultValue 'outer'
|
|
114
|
+
*/
|
|
112
115
|
orientation?: 'inner' | 'outer';
|
|
113
116
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
117
|
+
* Specify the domain of axis when the axis is a number axis.
|
|
118
|
+
*
|
|
119
|
+
* If undefined, then the domain is calculated based on the data and dataKeys.
|
|
120
|
+
*
|
|
121
|
+
* The length of domain should be 2, and we will validate the values in domain.
|
|
122
|
+
*
|
|
123
|
+
* Each element in the array can be a number, 'auto', 'dataMin', 'dataMax', a string like 'dataMin - 20', 'dataMax + 100',
|
|
124
|
+
* or a function that accepts a single argument and returns a number.
|
|
125
|
+
*
|
|
126
|
+
* If any element of domain is set to be 'auto', comprehensible scale ticks will be calculated, and the final domain of axis is generated by the ticks.
|
|
127
|
+
* If a function, receives '[dataMin, dataMax]', and must return a computed domain as '[min, max]'.
|
|
128
|
+
*
|
|
129
|
+
* @example <PolarAngleAxis type="number" domain={['dataMin', 'dataMax']} />
|
|
130
|
+
* @example <PolarAngleAxis type="number" domain={[0, 'dataMax']} />
|
|
131
|
+
* @example <PolarAngleAxis type="number" domain={['auto', 'auto']} />
|
|
132
|
+
* @example <PolarAngleAxis type="number" domain={[0, 'dataMax + 1000']} />
|
|
133
|
+
* @example <PolarAngleAxis type="number" domain={['dataMin - 100', 'dataMax + 100']} />
|
|
134
|
+
* @example <PolarAngleAxis type="number" domain={[dataMin => (0 - Math.abs(dataMin)), dataMax => (dataMax * 2)]} />
|
|
135
|
+
* @example <PolarAngleAxis type="number" domain={([dataMin, dataMax]) => { const absMax = Math.max(Math.abs(dataMin), Math.abs(dataMax)); return [-absMax, absMax]; }} />
|
|
136
|
+
* @example <PolarAngleAxis type="number" domain={[0, 100]} allowDataOverflow />
|
|
137
|
+
*/
|
|
135
138
|
domain?: AxisDomain;
|
|
136
139
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
scale?:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
140
|
+
* Scale function determines how data values are mapped to visual values.
|
|
141
|
+
* In other words, decided the mapping between data domain and coordinate range.
|
|
142
|
+
*
|
|
143
|
+
* If undefined, or 'auto', the scale function is created internally according to the type of axis and data.
|
|
144
|
+
*
|
|
145
|
+
* You can define a custom scale, either as a string shortcut to a d3 scale, or as a complete scale definition object.
|
|
146
|
+
*
|
|
147
|
+
* @defaultValue auto
|
|
148
|
+
* @example <PolarAngleAxis scale="log" />
|
|
149
|
+
* @example
|
|
150
|
+
* import { scaleLog } from 'd3-scale';
|
|
151
|
+
* const scale = scaleLog().base(Math.E);
|
|
152
|
+
* <PolarAngleAxis scale={scale} />
|
|
153
|
+
*/
|
|
154
|
+
scale?:
|
|
155
|
+
| ScaleType
|
|
156
|
+
| CustomScaleDefinition
|
|
157
|
+
| CustomScaleDefinition<string>
|
|
158
|
+
| CustomScaleDefinition<number>
|
|
159
|
+
| CustomScaleDefinition<Date>;
|
|
156
160
|
/**
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
* The outer radius of circle grid.
|
|
162
|
+
* If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy.
|
|
163
|
+
*/
|
|
160
164
|
radius?: number | string;
|
|
161
165
|
/**
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
166
|
+
* Defines how the individual label text is rendered.
|
|
167
|
+
* This controls the settings for individual ticks; on a typical axis, there are multiple ticks, depending on your data.
|
|
168
|
+
*
|
|
169
|
+
* If you want to customize the overall axis label, use the `label` prop instead.
|
|
170
|
+
*
|
|
171
|
+
* Options:
|
|
172
|
+
* - `false`: Do not render any tick labels.
|
|
173
|
+
* - `true`: Render tick labels with default settings.
|
|
174
|
+
* - `object`: An object of props to be merged into the internally calculated tick props.
|
|
175
|
+
* - `OctaneElement`: A custom React element to be used as the tick label.
|
|
176
|
+
* - `function`: A function that returns a React element for custom rendering of tick labels.
|
|
177
|
+
*
|
|
178
|
+
* @defaultValue true
|
|
179
|
+
*/
|
|
176
180
|
tick?: TickProp<PolarTickContentProps>;
|
|
177
181
|
/**
|
|
178
|
-
|
|
179
|
-
|
|
182
|
+
* The count of axis ticks. Not used if 'type' is 'category'.
|
|
183
|
+
*/
|
|
180
184
|
tickCount?: number;
|
|
181
185
|
/**
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
* Controls how Recharts calculates "nice" tick values for this axis.
|
|
187
|
+
* Options: `'none'`, `'auto'`, `'adaptive'`, `'snap125'`.
|
|
188
|
+
* See {@link NiceTicksAlgorithm} for a full description of each option.
|
|
189
|
+
*
|
|
190
|
+
* @defaultValue 'auto'
|
|
191
|
+
*/
|
|
188
192
|
niceTicks?: NiceTicksAlgorithm;
|
|
189
193
|
/**
|
|
190
|
-
|
|
191
|
-
|
|
194
|
+
* The formatter function of ticks.
|
|
195
|
+
*/
|
|
192
196
|
tickFormatter?: (value: any, index: number) => string;
|
|
193
197
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
198
|
+
* The length of tick line.
|
|
199
|
+
* @defaultValue 8
|
|
200
|
+
*/
|
|
197
201
|
tickSize?: number;
|
|
198
202
|
/**
|
|
199
|
-
|
|
200
|
-
|
|
203
|
+
* The array of tick values to map through the axis scale.
|
|
204
|
+
*/
|
|
201
205
|
ticks?: ReadonlyArray<AxisTick>;
|
|
202
206
|
/**
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
207
|
+
* The type of axis.
|
|
208
|
+
*
|
|
209
|
+
* `category`: Treats data as distinct values.
|
|
210
|
+
* Each value is in the same distance from its neighbors, regardless of their actual numeric difference.
|
|
211
|
+
*
|
|
212
|
+
* `number`: Treats data as continuous range.
|
|
213
|
+
* Values that are numerically closer are placed closer together on the axis.
|
|
214
|
+
*
|
|
215
|
+
* `auto`: the type is inferred based on the chart layout.
|
|
216
|
+
*
|
|
217
|
+
* @defaultValue auto
|
|
218
|
+
*/
|
|
215
219
|
type?: AxisDomainTypeInput;
|
|
216
220
|
/**
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
221
|
+
* Z-Index of this component and its children. The higher the value,
|
|
222
|
+
* the more on top it will be rendered.
|
|
223
|
+
* Components with higher zIndex will appear in front of components with lower zIndex.
|
|
224
|
+
* If undefined or 0, the content is rendered in the default layer without portals.
|
|
225
|
+
*
|
|
226
|
+
* @since 3.4
|
|
227
|
+
* @defaultValue 500
|
|
228
|
+
* @see {@link https://recharts.github.io/en-US/guide/zIndex/ Z-Index and layers guide}
|
|
229
|
+
*/
|
|
226
230
|
zIndex?: number;
|
|
227
231
|
}
|
|
228
232
|
|
|
229
233
|
type PolarAngleAxisEvents = {
|
|
230
234
|
/**
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
* The customized event handler of click on the ticks of this axis
|
|
236
|
+
*/
|
|
233
237
|
onClick?: (data: TickItem, index: number, e: NativeMouseEvent<SVGGElement>) => void;
|
|
234
238
|
/**
|
|
235
|
-
|
|
236
|
-
|
|
239
|
+
* The customized event handler of mousedown on the ticks of this axis
|
|
240
|
+
*/
|
|
237
241
|
onMouseDown?: (data: TickItem, index: number, e: NativeMouseEvent<SVGGElement>) => void;
|
|
238
242
|
/**
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
* The customized event handler of mouseup on the ticks of this axis
|
|
244
|
+
*/
|
|
241
245
|
onMouseUp?: (data: TickItem, index: number, e: NativeMouseEvent<SVGGElement>) => void;
|
|
242
246
|
/**
|
|
243
|
-
|
|
244
|
-
|
|
247
|
+
* The customized event handler of mousemove on the ticks of this axis
|
|
248
|
+
*/
|
|
245
249
|
onMouseMove?: (data: TickItem, index: number, e: NativeMouseEvent<SVGGElement>) => void;
|
|
246
250
|
/**
|
|
247
|
-
|
|
248
|
-
|
|
251
|
+
* The customized event handler of mouseover on the ticks of this axis
|
|
252
|
+
*/
|
|
249
253
|
onMouseOver?: (data: TickItem, index: number, e: NativeMouseEvent<SVGGElement>) => void;
|
|
250
254
|
/**
|
|
251
|
-
|
|
252
|
-
|
|
255
|
+
* The customized event handler of mouseout on the ticks of this axis
|
|
256
|
+
*/
|
|
253
257
|
onMouseOut?: (data: TickItem, index: number, e: NativeMouseEvent<SVGGElement>) => void;
|
|
254
258
|
/**
|
|
255
|
-
|
|
256
|
-
|
|
259
|
+
* The customized event handler of mouseenter on the ticks of this axis
|
|
260
|
+
*/
|
|
257
261
|
onMouseEnter?: (data: TickItem, index: number, e: NativeMouseEvent<SVGGElement>) => void;
|
|
258
262
|
/**
|
|
259
|
-
|
|
260
|
-
|
|
263
|
+
* The customized event handler of mouseleave on the ticks of this axis
|
|
264
|
+
*/
|
|
261
265
|
onMouseLeave?: (data: TickItem, index: number, e: NativeMouseEvent<SVGGElement>) => void;
|
|
262
266
|
onTouchStart?: (data: TickItem, index: number, e: NativeTouchEvent<SVGGElement>) => void;
|
|
263
267
|
onTouchMove?: (data: TickItem, index: number, e: NativeTouchEvent<SVGGElement>) => void;
|
|
264
268
|
onTouchEnd?: (data: TickItem, index: number, e: NativeTouchEvent<SVGGElement>) => void;
|
|
265
269
|
};
|
|
266
270
|
|
|
267
|
-
type AxisSvgProps =
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
> & { ref?: never };
|
|
271
|
+
type AxisSvgProps = Omit<
|
|
272
|
+
PresentationAttributesAdaptChildEvent<TickItem, SVGGElement>,
|
|
273
|
+
'scale' | 'type' | 'dangerouslySetInnerHTML' | 'ref'
|
|
274
|
+
> & { ref?: never };
|
|
272
275
|
|
|
273
|
-
export type Props<DataPointType = any, DataValueType = any> =
|
|
274
|
-
|
|
276
|
+
export type Props<DataPointType = any, DataValueType = any> = AxisSvgProps &
|
|
277
|
+
PolarAngleAxisProps<DataPointType, DataValueType>;
|
|
275
278
|
|
|
276
|
-
type PropsWithDefaults<DataPointType = any, DataValueType = any> =
|
|
277
|
-
|
|
279
|
+
type PropsWithDefaults<DataPointType = any, DataValueType = any> = RequiresDefaultProps<
|
|
280
|
+
Props<DataPointType, DataValueType>,
|
|
281
|
+
typeof defaultPolarAngleAxisProps
|
|
282
|
+
>;
|
|
278
283
|
|
|
279
|
-
type InternalPolarAngleAxisProps =
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
} & PolarAngleAxisEvents;
|
|
284
|
+
type InternalPolarAngleAxisProps = Omit<PropsWithDefaults, 'scale' | 'ticks'> & {
|
|
285
|
+
cx: number;
|
|
286
|
+
cy: number;
|
|
287
|
+
radius: number;
|
|
288
|
+
ticks: ReadonlyArray<TickItem>;
|
|
289
|
+
scale: RechartsScale;
|
|
290
|
+
} & PolarAngleAxisEvents;
|
|
287
291
|
|
|
288
292
|
const AXIS_TYPE = 'angleAxis';
|
|
289
293
|
|
|
290
|
-
type AngleAxisSettingsReporter =
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
};
|
|
294
|
+
type AngleAxisSettingsReporter = Omit<AngleAxisSettings, 'type'> & {
|
|
295
|
+
children: OctaneNode;
|
|
296
|
+
type: AxisDomainTypeInput;
|
|
297
|
+
};
|
|
295
298
|
|
|
296
299
|
function SetAngleAxisSettings(props: AngleAxisSettingsReporter): OctaneNode {
|
|
297
300
|
const dispatch = useAppDispatch();
|
|
@@ -403,21 +406,25 @@ const AxisLine = (props: InternalPolarAngleAxisProps) => {
|
|
|
403
406
|
};
|
|
404
407
|
|
|
405
408
|
if (axisLineType === 'circle') {
|
|
406
|
-
return
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
409
|
+
return (
|
|
410
|
+
<Dot
|
|
411
|
+
className="recharts-polar-angle-axis-line"
|
|
412
|
+
{...(axisLineProps as SVGPropsForHost<typeof axisLineProps, SVGCircleElement>)}
|
|
413
|
+
cx={cx}
|
|
414
|
+
cy={cy}
|
|
415
|
+
r={radius}
|
|
416
|
+
/>
|
|
417
|
+
);
|
|
413
418
|
}
|
|
414
419
|
const points = ticks.map((entry) => polarToCartesian(cx, cy, radius, entry.coordinate));
|
|
415
420
|
|
|
416
|
-
return
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
+
return (
|
|
422
|
+
<Polygon
|
|
423
|
+
className="recharts-polar-angle-axis-line"
|
|
424
|
+
{...(axisLineProps as SVGPropsForHost<typeof axisLineProps, SVGPathElement>)}
|
|
425
|
+
points={points}
|
|
426
|
+
/>
|
|
427
|
+
);
|
|
421
428
|
};
|
|
422
429
|
|
|
423
430
|
type TickItemProps = {
|
|
@@ -436,7 +443,11 @@ const TickItemText = ({ tick, tickProps, value }: TickItemProps): OctaneNode =>
|
|
|
436
443
|
if (typeof tick === 'function') {
|
|
437
444
|
return tick(tickProps);
|
|
438
445
|
}
|
|
439
|
-
return
|
|
446
|
+
return (
|
|
447
|
+
<Text {...tickProps} className="recharts-polar-angle-axis-tick-value">
|
|
448
|
+
{value}
|
|
449
|
+
</Text>
|
|
450
|
+
);
|
|
440
451
|
};
|
|
441
452
|
|
|
442
453
|
const Ticks = (props: InternalPolarAngleAxisProps) => {
|
|
@@ -466,19 +477,22 @@ const Ticks = (props: InternalPolarAngleAxisProps) => {
|
|
|
466
477
|
y: lineCoord.y2,
|
|
467
478
|
};
|
|
468
479
|
|
|
469
|
-
return
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
return (
|
|
481
|
+
<Layer
|
|
482
|
+
className={clsx('recharts-polar-angle-axis-tick', getClassNameFromUnknown(tick))}
|
|
483
|
+
key={`tick-${entry.coordinate}`}
|
|
484
|
+
{...adaptEventsOfChild(props, entry, i)}
|
|
485
|
+
>
|
|
486
|
+
{tickLine && (
|
|
487
|
+
<line className="recharts-polar-angle-axis-tick-line" {...tickLineProps} {...lineCoord} />
|
|
488
|
+
)}
|
|
489
|
+
<TickItemText
|
|
490
|
+
tick={tick}
|
|
491
|
+
tickProps={tickProps}
|
|
492
|
+
value={tickFormatter ? tickFormatter(entry.value, i) : entry.value}
|
|
493
|
+
/>
|
|
494
|
+
</Layer>
|
|
495
|
+
);
|
|
482
496
|
});
|
|
483
497
|
|
|
484
498
|
return <Layer className="recharts-polar-angle-axis-ticks">{items}</Layer>;
|
|
@@ -492,8 +506,8 @@ export const PolarAngleAxisWrapper: FunctionComponent<PropsWithDefaults> = (
|
|
|
492
506
|
const viewBox = useAppSelector(selectPolarViewBox);
|
|
493
507
|
const scale = useAppSelector((state) => selectPolarAxisScale(state, 'angleAxis', angleAxisId));
|
|
494
508
|
const isPanorama = useIsPanorama();
|
|
495
|
-
const ticks = useAppSelector(
|
|
496
|
-
|
|
509
|
+
const ticks = useAppSelector((state) =>
|
|
510
|
+
selectPolarAngleAxisTicks(state, 'angleAxis', angleAxisId, isPanorama),
|
|
497
511
|
);
|
|
498
512
|
|
|
499
513
|
if (viewBox == null || !ticks || !ticks.length || scale == null) {
|
|
@@ -508,12 +522,14 @@ export const PolarAngleAxisWrapper: FunctionComponent<PropsWithDefaults> = (
|
|
|
508
522
|
ticks,
|
|
509
523
|
};
|
|
510
524
|
|
|
511
|
-
return
|
|
512
|
-
<
|
|
513
|
-
<
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
525
|
+
return (
|
|
526
|
+
<ZIndexLayer zIndex={props.zIndex}>
|
|
527
|
+
<Layer className={clsx('recharts-polar-angle-axis', AXIS_TYPE, props.className)}>
|
|
528
|
+
<AxisLine {...props} />
|
|
529
|
+
<Ticks {...props} />
|
|
530
|
+
</Layer>
|
|
531
|
+
</ZIndexLayer>
|
|
532
|
+
);
|
|
517
533
|
};
|
|
518
534
|
|
|
519
535
|
/**
|
|
@@ -528,27 +544,29 @@ export function PolarAngleAxis<DataPointType = any, DataValueType = any>(
|
|
|
528
544
|
defaultPolarAngleAxisProps,
|
|
529
545
|
);
|
|
530
546
|
|
|
531
|
-
return
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
547
|
+
return (
|
|
548
|
+
<SetAngleAxisSettings
|
|
549
|
+
id={props.angleAxisId}
|
|
550
|
+
scale={props.scale}
|
|
551
|
+
type={props.type}
|
|
552
|
+
dataKey={props.dataKey}
|
|
553
|
+
unit={undefined}
|
|
554
|
+
name={props.name}
|
|
555
|
+
allowDuplicatedCategory={false}
|
|
556
|
+
// Ignoring the prop on purpose because axis calculation behaves as if it was false and Tooltip requires it to be true.
|
|
557
|
+
allowDataOverflow={false}
|
|
558
|
+
reversed={props.reversed}
|
|
559
|
+
includeHidden={false}
|
|
560
|
+
allowDecimals={props.allowDecimals}
|
|
561
|
+
tickCount={props.tickCount}
|
|
562
|
+
niceTicks={props.niceTicks ?? 'auto'}
|
|
563
|
+
ticks={props.ticks}
|
|
564
|
+
tick={props.tick}
|
|
565
|
+
domain={props.domain}
|
|
566
|
+
>
|
|
567
|
+
<PolarAngleAxisWrapper {...props} />
|
|
568
|
+
</SetAngleAxisSettings>
|
|
569
|
+
);
|
|
552
570
|
}
|
|
553
571
|
|
|
554
572
|
PolarAngleAxis.displayName = 'PolarAngleAxis';
|