@octanejs/recharts 0.1.62 → 0.1.63
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
|
@@ -114,34 +114,34 @@ export interface ScatterPointNode {
|
|
|
114
114
|
*/
|
|
115
115
|
export interface ScatterPointItem {
|
|
116
116
|
/**
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
* The x coordinate of the point center in pixels.
|
|
118
|
+
*/
|
|
119
119
|
cx: number | null | undefined;
|
|
120
120
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
* The y coordinate of the point center in pixels.
|
|
122
|
+
*/
|
|
123
123
|
cy: number | null | undefined;
|
|
124
124
|
/**
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
* The x coordinate (in pixels) of the top-left corner of the rectangle that wraps the point.
|
|
126
|
+
*/
|
|
127
127
|
x: number | undefined;
|
|
128
128
|
/**
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
* The y coordinate (in pixels) of the top-left corner of the rectangle that wraps the point.
|
|
130
|
+
*/
|
|
131
131
|
y: number | undefined;
|
|
132
132
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
* ScatterPointItem size is an abstract number that is used to calculate the radius of the point.
|
|
134
|
+
* It's not the radius itself, but rather a value that is used to calculate the radius.
|
|
135
|
+
* Interacts with the zAxis range.
|
|
136
|
+
*/
|
|
137
137
|
size: number | undefined;
|
|
138
138
|
/**
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
* Width of the point in pixels.
|
|
140
|
+
*/
|
|
141
141
|
width: number;
|
|
142
142
|
/**
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
* Height of the point in pixels.
|
|
144
|
+
*/
|
|
145
145
|
height: number;
|
|
146
146
|
node: ScatterPointNode;
|
|
147
147
|
payload?: any;
|
|
@@ -191,215 +191,214 @@ interface ScatterInternalProps extends ZIndexable {
|
|
|
191
191
|
/**
|
|
192
192
|
* External props, intended for end users to fill in
|
|
193
193
|
*/
|
|
194
|
-
interface ScatterProps<DataPointType = any, DataValueType = any>
|
|
195
|
-
DataPointType
|
|
196
|
-
>, DataConsumer<DataPointType, DataValueType>, ZIndexable {
|
|
194
|
+
interface ScatterProps<DataPointType = any, DataValueType = any>
|
|
195
|
+
extends DataProvider<DataPointType>, DataConsumer<DataPointType, DataValueType>, ZIndexable {
|
|
197
196
|
/**
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
* Unique identifier of this component.
|
|
198
|
+
* Used as an HTML attribute `id`, and also to identify this element internally.
|
|
199
|
+
*
|
|
200
|
+
* If undefined, Recharts will generate a unique ID automatically.
|
|
201
|
+
*/
|
|
203
202
|
id?: string;
|
|
204
203
|
/**
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
* The id of XAxis which is corresponding to the data. Required when there are multiple XAxes.
|
|
205
|
+
* @defaultValue 0
|
|
206
|
+
*/
|
|
208
207
|
xAxisId?: AxisId;
|
|
209
208
|
/**
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
* The id of YAxis which is corresponding to the data. Required when there are multiple YAxes.
|
|
210
|
+
* @defaultValue 0
|
|
211
|
+
*/
|
|
213
212
|
yAxisId?: AxisId;
|
|
214
213
|
/**
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
* The id of ZAxis which is corresponding to the data. Required when there are multiple ZAxes.
|
|
215
|
+
*
|
|
216
|
+
* ZAxis does not render directly, has no ticks and no tick line.
|
|
217
|
+
* It is used to control the size of each scatter point.
|
|
218
|
+
*
|
|
219
|
+
* @defaultValue 0
|
|
220
|
+
* @see {@link https://recharts.github.io/en-US/examples/ThreeDimScatterChart/ Scatter chart with Z axis}
|
|
221
|
+
*/
|
|
223
222
|
zAxisId?: AxisId;
|
|
224
223
|
/**
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
224
|
+
* Renders line connecting individual points.
|
|
225
|
+
* Options:
|
|
226
|
+
* - `false`: no line is drawn.
|
|
227
|
+
* - `true`: a default line is drawn.
|
|
228
|
+
* - `OctaneElement`: the option is the custom line element.
|
|
229
|
+
* - `function`: the function will be called to render customized line.
|
|
230
|
+
* - `object`: the option is the props of Curve element.
|
|
231
|
+
*
|
|
232
|
+
* Also see the `lineType` prop which controls how is this line calculated.
|
|
233
|
+
*
|
|
234
|
+
* @defaultValue false
|
|
235
|
+
* @example <Scatter line />
|
|
236
|
+
* @example <Scatter line={CustomizedLineComponent} />
|
|
237
|
+
* @example <Scatter line={{ strokeDasharray: '5 5' }} />
|
|
238
|
+
*
|
|
239
|
+
* @see {@link https://recharts.github.io/en-US/examples/JointLineScatterChart/ Scatter chart with joint line}
|
|
240
|
+
*/
|
|
242
241
|
line?: OctaneElement<CurveProps> | ((props: CurveProps) => OctaneNode) | CurveProps | boolean;
|
|
243
242
|
/**
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
243
|
+
* Determines calculation method of the line if the `line` prop is set.
|
|
244
|
+
* Options:
|
|
245
|
+
* - `'joint'`: line will be generated by connecting all the points.
|
|
246
|
+
* - `'fitting'`: line will be generated by fitting algorithm (linear regression).
|
|
247
|
+
*
|
|
248
|
+
* Has no effect if `line` prop is not set or is false.
|
|
249
|
+
*
|
|
250
|
+
* @defaultValue joint
|
|
251
|
+
* @example <Scatter line lineType="fitting" />
|
|
252
|
+
* @see {@link https://recharts.github.io/en-US/examples/JointLineScatterChart/ Scatter chart with joint line}
|
|
253
|
+
*/
|
|
255
254
|
lineType?: 'fitting' | 'joint';
|
|
256
255
|
/**
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
256
|
+
* Determines the shape of joint line.
|
|
257
|
+
* Same as `type` prop on Curve, Line and Area components.
|
|
258
|
+
*
|
|
259
|
+
* Has no effect if `line` prop is not set or is false or if `lineType` is 'fitting'.
|
|
260
|
+
*
|
|
261
|
+
* @defaultValue linear
|
|
262
|
+
* @see {@link https://recharts.github.io/en-US/examples/JointLineScatterChart/ Scatter chart with joint line}
|
|
263
|
+
*/
|
|
265
264
|
lineJointType?: CurveType;
|
|
266
265
|
/**
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
266
|
+
* The type of icon in legend.
|
|
267
|
+
* If set to 'none', no legend item will be rendered.
|
|
268
|
+
*
|
|
269
|
+
* @defaultValue 'circle'
|
|
270
|
+
* @example <Scatter legendType="diamond" />
|
|
271
|
+
*/
|
|
273
272
|
legendType?: LegendType;
|
|
274
273
|
tooltipType?: TooltipType;
|
|
275
274
|
/**
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
* Formats the value displayed in the tooltip for this Scatter.
|
|
276
|
+
* When set, takes precedence over the `formatter` prop on the Tooltip component.
|
|
277
|
+
*/
|
|
279
278
|
formatter?: Formatter;
|
|
280
279
|
className?: string;
|
|
281
280
|
/**
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
281
|
+
* The name of data.
|
|
282
|
+
* This option will be used in tooltip and legend to represent this graphical item.
|
|
283
|
+
* If no value was set to this option, the value of dataKey will be used alternatively.
|
|
284
|
+
*/
|
|
286
285
|
name?: string;
|
|
287
286
|
/**
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
287
|
+
* This component is rendered when this graphical item is activated
|
|
288
|
+
* (could be by mouse hover, touch, keyboard, programmatically).
|
|
289
|
+
*
|
|
290
|
+
* @see {@link https://recharts.github.io/en-US/examples/SimpleScatterChart/ Scatter chart with custom active shape}
|
|
291
|
+
* @example <Scatter activeShape={{ fill: 'red' }} />
|
|
292
|
+
*/
|
|
294
293
|
activeShape?: ScatterCustomizedShape;
|
|
295
294
|
/**
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
295
|
+
* Determines the shape of individual data points.
|
|
296
|
+
* - Can be one of the predefined shapes as a string, which will be passed to {@link Symbols} component.
|
|
297
|
+
* - If set a OctaneElement, the shape of point can be customized.
|
|
298
|
+
* - If set a function, the function will be called to render customized shape.
|
|
299
|
+
* - During animations, the function shape also receives `animationElapsedTime`, `isAnimating`, and `isEntrance`.
|
|
300
|
+
* @defaultValue circle
|
|
301
|
+
*
|
|
302
|
+
* @example <Scatter shape={CustomizedShapeComponent} />
|
|
303
|
+
* @example <Scatter shape="diamond" />
|
|
304
|
+
*
|
|
305
|
+
* @see {@link https://recharts.github.io/en-US/examples/JointLineScatterChart/ Scatter chart with custom shapes}
|
|
306
|
+
*/
|
|
308
307
|
shape?: ScatterCustomizedShape;
|
|
309
308
|
/**
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
309
|
+
* Hides the whole graphical element when true.
|
|
310
|
+
*
|
|
311
|
+
* Hiding an element is different from removing it from the chart:
|
|
312
|
+
* Hidden graphical elements are still visible in Legend,
|
|
313
|
+
* and can be included in axis domain calculations,
|
|
314
|
+
* depending on `includeHidden` props of your XAxis/YAxis.
|
|
315
|
+
*
|
|
316
|
+
* @defaultValue false
|
|
317
|
+
*/
|
|
319
318
|
hide?: boolean;
|
|
320
319
|
/**
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
320
|
+
* Renders one label for each data point. Options:
|
|
321
|
+
* - `true`: renders default labels;
|
|
322
|
+
* - `false`: no labels are rendered;
|
|
323
|
+
* - `object`: the props of LabelList component;
|
|
324
|
+
* - `OctaneElement`: a custom SVG label element, such as `<text>` or `<g>`.
|
|
325
|
+
* HTML elements such as `<div>` are not valid inside the chart SVG and may trigger React DOM warnings.
|
|
326
|
+
* - `function`: a render function of custom label.
|
|
327
|
+
*
|
|
328
|
+
* @defaultValue false
|
|
329
|
+
*/
|
|
331
330
|
label?: ImplicitLabelListType;
|
|
332
331
|
/**
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
332
|
+
* If set false, animation of Scatter points will be disabled.
|
|
333
|
+
* If set "auto", the animation will be disabled in SSR and will respect the user's prefers-reduced-motion system preference for accessibility.
|
|
334
|
+
* @defaultValue 'auto'
|
|
335
|
+
*/
|
|
337
336
|
isAnimationActive?: boolean | 'auto';
|
|
338
337
|
/**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
338
|
+
* Specifies when the animation should begin, the unit of this option is ms.
|
|
339
|
+
* @defaultValue 0
|
|
340
|
+
*/
|
|
342
341
|
animationBegin?: number;
|
|
343
342
|
/**
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
343
|
+
* Specifies the duration of animation, the unit of this option is ms.
|
|
344
|
+
* @defaultValue 400
|
|
345
|
+
*/
|
|
347
346
|
animationDuration?: AnimationDuration;
|
|
348
347
|
/**
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
348
|
+
* The type of easing function.
|
|
349
|
+
* @defaultValue 'linear'
|
|
350
|
+
*/
|
|
352
351
|
animationEasing?: EasingInput;
|
|
353
352
|
/**
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
353
|
+
* Custom animation function for interpolating data items.
|
|
354
|
+
* When provided, this replaces the default animation interpolation.
|
|
355
|
+
*
|
|
356
|
+
* @param prevItems The items from the previous animation frame, or null on first render
|
|
357
|
+
* @param nextItems The target items to animate towards
|
|
358
|
+
* @param animationElapsedTime A normalized time value (0 = start, 1 = end)
|
|
359
|
+
* @returns The interpolated items at time animationElapsedTime
|
|
360
|
+
*
|
|
361
|
+
* @since 3.9
|
|
362
|
+
* @see {@link https://recharts.github.io/en-US/guide/animations/ Animations guide}
|
|
363
|
+
*/
|
|
365
364
|
animationInterpolateFn?: AnimationInterpolateFn<ScatterPointItem, CartesianLayout>;
|
|
366
365
|
/**
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
366
|
+
* Strategy for matching previous items to next items during animation.
|
|
367
|
+
* Determines how Recharts pairs old data points with new data points
|
|
368
|
+
* to create smooth transitions.
|
|
369
|
+
*
|
|
370
|
+
* - `matchAppend` (default): match sequentially by index and treat newly appended items as new
|
|
371
|
+
* - `matchByIndex`: match by array position with proportional stretching
|
|
372
|
+
* - `matchByDataKey('someKey')`: match by a data key from the payload
|
|
373
|
+
* - Custom function `(item, index) => key`: match by the returned key
|
|
374
|
+
*
|
|
375
|
+
* @defaultValue append
|
|
376
|
+
* @see matchByIndex
|
|
377
|
+
* @see matchByDataKey
|
|
378
|
+
* @see matchAppend
|
|
379
|
+
*
|
|
380
|
+
* @since 3.9
|
|
381
|
+
* @see {@link https://recharts.github.io/en-US/guide/animations/ Animations guide}
|
|
382
|
+
*/
|
|
384
383
|
animationMatchBy?: AnimationMatchByProp<ScatterPointItem>;
|
|
385
384
|
/**
|
|
386
|
-
|
|
387
|
-
|
|
385
|
+
* Called when the Scatter animation starts.
|
|
386
|
+
*/
|
|
388
387
|
onAnimationStart?: () => void;
|
|
389
388
|
/**
|
|
390
|
-
|
|
391
|
-
|
|
389
|
+
* Called when the Scatter animation finishes.
|
|
390
|
+
*/
|
|
392
391
|
onAnimationEnd?: () => void;
|
|
393
392
|
/**
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
393
|
+
* Z-Index of this component and its children. The higher the value,
|
|
394
|
+
* the more on top it will be rendered.
|
|
395
|
+
* Components with higher zIndex will appear in front of components with lower zIndex.
|
|
396
|
+
* If undefined or 0, the content is rendered in the default layer without portals.
|
|
397
|
+
*
|
|
398
|
+
* @since 3.4
|
|
399
|
+
* @defaultValue 600
|
|
400
|
+
* @see {@link https://recharts.github.io/en-US/guide/zIndex/ Z-Index and layers guide}
|
|
401
|
+
*/
|
|
403
402
|
zIndex?: number;
|
|
404
403
|
children?: OctaneNode;
|
|
405
404
|
}
|
|
@@ -407,16 +406,15 @@ interface ScatterProps<DataPointType = any, DataValueType = any> extends DataPro
|
|
|
407
406
|
/**
|
|
408
407
|
* Because of naming conflict, we are forced to ignore certain (valid) SVG attributes.
|
|
409
408
|
*/
|
|
410
|
-
type BaseScatterSvgProps =
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
>;
|
|
409
|
+
type BaseScatterSvgProps = Omit<
|
|
410
|
+
PresentationAttributesAdaptChildEvent<ScatterPointItem, SVGGraphicsElement>,
|
|
411
|
+
'points' | 'ref' | 'children' | 'dangerouslySetInnerHTML'
|
|
412
|
+
>;
|
|
415
413
|
|
|
416
414
|
type InternalProps = BaseScatterSvgProps & ScatterInternalProps;
|
|
417
415
|
|
|
418
|
-
export type Props<DataPointType = any, ValueAxisType = any> =
|
|
419
|
-
|
|
416
|
+
export type Props<DataPointType = any, ValueAxisType = any> = BaseScatterSvgProps &
|
|
417
|
+
ScatterProps<DataPointType, ValueAxisType>;
|
|
420
418
|
|
|
421
419
|
const computeLegendPayloadFromScatterProps = (props: Props): ReadonlyArray<LegendPayload> => {
|
|
422
420
|
const { dataKey, name, fill, legendType, hide } = props;
|
|
@@ -445,45 +443,46 @@ type InputRequiredToComputeTooltipEntrySettings = {
|
|
|
445
443
|
id: GraphicalItemId;
|
|
446
444
|
};
|
|
447
445
|
|
|
448
|
-
const SetScatterTooltipEntrySettings = React.memo(
|
|
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
|
-
}
|
|
446
|
+
const SetScatterTooltipEntrySettings = React.memo(
|
|
447
|
+
({
|
|
448
|
+
dataKey,
|
|
449
|
+
points,
|
|
450
|
+
stroke,
|
|
451
|
+
strokeWidth,
|
|
452
|
+
fill,
|
|
453
|
+
name,
|
|
454
|
+
hide,
|
|
455
|
+
formatter,
|
|
456
|
+
tooltipType,
|
|
457
|
+
id,
|
|
458
|
+
}: InputRequiredToComputeTooltipEntrySettings) => {
|
|
459
|
+
const tooltipEntrySettings: TooltipPayloadConfiguration = {
|
|
460
|
+
dataDefinedOnItem: points?.map((p: ScatterPointItem) => p.tooltipPayload),
|
|
461
|
+
getPosition: (index) => points?.[Number(index)]?.tooltipPosition,
|
|
462
|
+
settings: {
|
|
463
|
+
stroke,
|
|
464
|
+
strokeWidth,
|
|
465
|
+
fill,
|
|
466
|
+
nameKey: undefined,
|
|
467
|
+
dataKey,
|
|
468
|
+
name: getTooltipNameProp(name, dataKey),
|
|
469
|
+
hide,
|
|
470
|
+
type: tooltipType,
|
|
471
|
+
color: fill,
|
|
472
|
+
unit: '', // why doesn't Scatter support unit?
|
|
473
|
+
formatter,
|
|
474
|
+
graphicalItemId: id,
|
|
475
|
+
},
|
|
476
|
+
};
|
|
477
|
+
return <SetTooltipEntrySettings tooltipEntrySettings={tooltipEntrySettings} />;
|
|
478
|
+
},
|
|
479
|
+
);
|
|
480
480
|
|
|
481
|
-
type ScatterSymbolsProps =
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
};
|
|
481
|
+
type ScatterSymbolsProps = ShapeAnimationProps & {
|
|
482
|
+
points: ReadonlyArray<ScatterPointItem>;
|
|
483
|
+
showLabels: boolean;
|
|
484
|
+
allOtherScatterProps: InternalProps;
|
|
485
|
+
};
|
|
487
486
|
|
|
488
487
|
function ScatterLine({
|
|
489
488
|
points,
|
|
@@ -529,7 +528,11 @@ function ScatterLine({
|
|
|
529
528
|
lineItem = <Curve {...lineProps} type={lineJointType} />;
|
|
530
529
|
}
|
|
531
530
|
|
|
532
|
-
return
|
|
531
|
+
return (
|
|
532
|
+
<Layer className="recharts-scatter-line" key="recharts-scatter-line">
|
|
533
|
+
{lineItem}
|
|
534
|
+
</Layer>
|
|
535
|
+
);
|
|
533
536
|
}
|
|
534
537
|
|
|
535
538
|
function ScatterLabelListProvider({
|
|
@@ -546,14 +549,14 @@ function ScatterLabelListProvider({
|
|
|
546
549
|
return points?.map((point): CartesianLabelListEntry => {
|
|
547
550
|
const viewBox: TrapezoidViewBox = {
|
|
548
551
|
/*
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
+
* Scatter label uses x and y as the reference point for the label,
|
|
553
|
+
* not cx and cy.
|
|
554
|
+
*/
|
|
552
555
|
x: point.x ?? 0,
|
|
553
556
|
/*
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
+
* Scatter label uses x and y as the reference point for the label,
|
|
558
|
+
* not cx and cy.
|
|
559
|
+
*/
|
|
557
560
|
y: point.y ?? 0,
|
|
558
561
|
width: point.width,
|
|
559
562
|
height: point.height,
|
|
@@ -563,10 +566,10 @@ function ScatterLabelListProvider({
|
|
|
563
566
|
return {
|
|
564
567
|
...viewBox,
|
|
565
568
|
/*
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
569
|
+
* Here we put undefined because Scatter shows two values usually, one for X and one for Y.
|
|
570
|
+
* LabelList will see this undefined and will use its own `dataKey` prop to determine which value to show,
|
|
571
|
+
* using the payload below.
|
|
572
|
+
*/
|
|
570
573
|
value: undefined,
|
|
571
574
|
payload: point.payload,
|
|
572
575
|
viewBox,
|
|
@@ -576,9 +579,11 @@ function ScatterLabelListProvider({
|
|
|
576
579
|
});
|
|
577
580
|
}, [chartViewBox, points]);
|
|
578
581
|
|
|
579
|
-
return
|
|
580
|
-
value={showLabels ? labelListEntries : undefined}
|
|
581
|
-
|
|
582
|
+
return (
|
|
583
|
+
<CartesianLabelListContextProvider value={showLabels ? labelListEntries : undefined}>
|
|
584
|
+
{children}
|
|
585
|
+
</CartesianLabelListContextProvider>
|
|
586
|
+
);
|
|
582
587
|
}
|
|
583
588
|
|
|
584
589
|
/**
|
|
@@ -619,15 +624,18 @@ function ScatterPoint({
|
|
|
619
624
|
baseProps: ReturnType<typeof svgPropertiesNoEvents>;
|
|
620
625
|
id: GraphicalItemId;
|
|
621
626
|
restOfAllOtherProps: InternalProps;
|
|
622
|
-
onMouseEnterFromContext: (
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
627
|
+
onMouseEnterFromContext: (
|
|
628
|
+
data: ScatterPointItem,
|
|
629
|
+
index: number,
|
|
630
|
+
) => (event: NativeMouseEvent<SVGGraphicsElement>) => void;
|
|
631
|
+
onMouseLeaveFromContext: (
|
|
632
|
+
data: ScatterPointItem,
|
|
633
|
+
index: number,
|
|
634
|
+
) => (event: NativeMouseEvent<SVGGraphicsElement>) => void;
|
|
635
|
+
onClickFromContext: (
|
|
636
|
+
data: ScatterPointItem,
|
|
637
|
+
index: number,
|
|
638
|
+
) => (event: NativeMouseEvent<SVGGraphicsElement>) => void;
|
|
631
639
|
}): OctaneElement {
|
|
632
640
|
const hasActiveShape = activeShape != null && activeShape !== false;
|
|
633
641
|
const selectIsActive = useMemo(() => {
|
|
@@ -638,8 +646,7 @@ function ScatterPoint({
|
|
|
638
646
|
const isActive: boolean = useAppSelector(selectIsActive) ?? false;
|
|
639
647
|
|
|
640
648
|
// isActive is only true when hasActiveShape is true, so activeShape is defined here
|
|
641
|
-
const option =
|
|
642
|
-
isActive && activeShape != null && activeShape !== false ? activeShape : shape;
|
|
649
|
+
const option = isActive && activeShape != null && activeShape !== false ? activeShape : shape;
|
|
643
650
|
const symbolProps: ScatterShapeProps = {
|
|
644
651
|
...baseProps,
|
|
645
652
|
...entry,
|
|
@@ -651,24 +658,26 @@ function ScatterPoint({
|
|
|
651
658
|
[DATA_ITEM_GRAPHICAL_ITEM_ID_ATTRIBUTE_NAME]: String(id),
|
|
652
659
|
};
|
|
653
660
|
|
|
654
|
-
return
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
<Layer
|
|
663
|
-
className="recharts-scatter-symbol"
|
|
664
|
-
{...adaptEventsOfChild(restOfAllOtherProps, entry, index)}
|
|
665
|
-
onMouseEnter={onMouseEnterFromContext(entry, index)}
|
|
666
|
-
onMouseLeave={onMouseLeaveFromContext(entry, index)}
|
|
667
|
-
onClick={onClickFromContext(entry, index)}
|
|
661
|
+
return (
|
|
662
|
+
<ZIndexLayer
|
|
663
|
+
/*
|
|
664
|
+
* inactive Scatters use the parent zIndex, which is represented by undefined here.
|
|
665
|
+
* ZIndexLayer will render undefined zIndex as-is, as regular children, without portals.
|
|
666
|
+
* Active Scatters use the activeDot zIndex so they render above other elements.
|
|
667
|
+
*/
|
|
668
|
+
zIndex={isActive ? DefaultZIndexes.activeDot : undefined}
|
|
668
669
|
>
|
|
669
|
-
<
|
|
670
|
-
|
|
671
|
-
|
|
670
|
+
<Layer
|
|
671
|
+
className="recharts-scatter-symbol"
|
|
672
|
+
{...adaptEventsOfChild(restOfAllOtherProps, entry, index)}
|
|
673
|
+
onMouseEnter={onMouseEnterFromContext(entry, index)}
|
|
674
|
+
onMouseLeave={onMouseLeaveFromContext(entry, index)}
|
|
675
|
+
onClick={onClickFromContext(entry, index)}
|
|
676
|
+
>
|
|
677
|
+
<ScatterSymbol option={option} {...symbolProps} />
|
|
678
|
+
</Layer>
|
|
679
|
+
</ZIndexLayer>
|
|
680
|
+
);
|
|
672
681
|
}
|
|
673
682
|
|
|
674
683
|
function ScatterSymbols(props: ScatterSymbolsProps) {
|
|
@@ -692,10 +701,10 @@ function ScatterSymbols(props: ScatterSymbolsProps) {
|
|
|
692
701
|
|
|
693
702
|
const baseProps = svgPropertiesNoEvents(allOtherPropsWithoutId);
|
|
694
703
|
|
|
695
|
-
return
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
(entry: ScatterPointItem, i: number) =>
|
|
704
|
+
return (
|
|
705
|
+
<>
|
|
706
|
+
<ScatterLine points={points} props={allOtherPropsWithoutId} />
|
|
707
|
+
{points.map((entry: ScatterPointItem, i: number) => (
|
|
699
708
|
<ScatterPoint
|
|
700
709
|
key={`symbol-${entry?.cx}-${entry?.cy}-${entry?.size}-${i}`}
|
|
701
710
|
entry={entry}
|
|
@@ -711,9 +720,10 @@ function ScatterSymbols(props: ScatterSymbolsProps) {
|
|
|
711
720
|
onMouseEnterFromContext={onMouseEnterFromContext}
|
|
712
721
|
onMouseLeaveFromContext={onMouseLeaveFromContext}
|
|
713
722
|
onClickFromContext={onClickFromContext}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
723
|
+
/>
|
|
724
|
+
))}
|
|
725
|
+
</>
|
|
726
|
+
);
|
|
717
727
|
}
|
|
718
728
|
|
|
719
729
|
const defaultScatterAnimateItems: AnimationInterpolateFn<ScatterPointItem, CartesianLayout> = (
|
|
@@ -730,20 +740,20 @@ const defaultScatterAnimateItems: AnimationInterpolateFn<ScatterPointItem, Carte
|
|
|
730
740
|
return [
|
|
731
741
|
{
|
|
732
742
|
...item.next,
|
|
733
|
-
cx:
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
743
|
+
cx:
|
|
744
|
+
item.next.cx == null
|
|
745
|
+
? undefined
|
|
746
|
+
: interpolate(item.prev.cx, item.next.cx, animationElapsedTime),
|
|
747
|
+
cy:
|
|
748
|
+
item.next.cy == null
|
|
749
|
+
? undefined
|
|
750
|
+
: interpolate(item.prev.cy, item.next.cy, animationElapsedTime),
|
|
739
751
|
size: interpolate(item.prev.size, item.next.size, animationElapsedTime),
|
|
740
752
|
},
|
|
741
753
|
];
|
|
742
754
|
}
|
|
743
755
|
// added
|
|
744
|
-
return [
|
|
745
|
-
{ ...item.next, size: interpolate(0, item.next.size, animationElapsedTime) },
|
|
746
|
-
];
|
|
756
|
+
return [{ ...item.next, size: interpolate(0, item.next.size, animationElapsedTime) }];
|
|
747
757
|
});
|
|
748
758
|
};
|
|
749
759
|
|
|
@@ -773,36 +783,40 @@ function SymbolsWithAnimation({
|
|
|
773
783
|
|
|
774
784
|
if (layout == null) return null;
|
|
775
785
|
|
|
776
|
-
return
|
|
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
|
-
|
|
786
|
+
return (
|
|
787
|
+
<ScatterLabelListProvider showLabels={!isAnimating} points={points}>
|
|
788
|
+
<AnimatedItems
|
|
789
|
+
animationInput={points}
|
|
790
|
+
animationIdPrefix="recharts-scatter-"
|
|
791
|
+
items={points}
|
|
792
|
+
previousItemsRef={previousPointsRef}
|
|
793
|
+
isAnimationActive={isAnimationActive}
|
|
794
|
+
animationBegin={animationBegin}
|
|
795
|
+
animationDuration={animationDuration}
|
|
796
|
+
animationEasing={animationEasing}
|
|
797
|
+
onAnimationStart={handleAnimationStart}
|
|
798
|
+
onAnimationEnd={handleAnimationEnd}
|
|
799
|
+
animationInterpolateFn={animationInterpolateFn}
|
|
800
|
+
animationMatchBy={props.animationMatchBy}
|
|
801
|
+
layout={layout}
|
|
802
|
+
>
|
|
803
|
+
{(stepData, animationElapsedTime, isEntrance) => (
|
|
804
|
+
<Layer>
|
|
805
|
+
<ScatterSymbols
|
|
806
|
+
points={stepData}
|
|
807
|
+
allOtherScatterProps={props}
|
|
808
|
+
showLabels={!isAnimating}
|
|
809
|
+
animationElapsedTime={animationElapsedTime}
|
|
810
|
+
isAnimating={isAnimating || animationElapsedTime < 1}
|
|
811
|
+
isEntrance={isEntrance}
|
|
812
|
+
/>
|
|
813
|
+
</Layer>
|
|
814
|
+
)}
|
|
815
|
+
</AnimatedItems>
|
|
816
|
+
{props.children}
|
|
817
|
+
<LabelListFromLabelProp label={props.label} />
|
|
818
|
+
</ScatterLabelListProvider>
|
|
819
|
+
);
|
|
806
820
|
}
|
|
807
821
|
|
|
808
822
|
export function computeScatterPoints({
|
|
@@ -829,16 +843,14 @@ export function computeScatterPoints({
|
|
|
829
843
|
const zAxisDataKey = zAxis && zAxis.dataKey;
|
|
830
844
|
const defaultRangeZ = zAxis ? zAxis.range : implicitZAxis.range;
|
|
831
845
|
const defaultZ = defaultRangeZ && defaultRangeZ[0];
|
|
832
|
-
const xBandSize =
|
|
833
|
-
|
|
834
|
-
const yBandSize =
|
|
835
|
-
yAxis.scale.bandwidth ? yAxis.scale.bandwidth() : 0;
|
|
846
|
+
const xBandSize = xAxis.scale.bandwidth ? xAxis.scale.bandwidth() : 0;
|
|
847
|
+
const yBandSize = yAxis.scale.bandwidth ? yAxis.scale.bandwidth() : 0;
|
|
836
848
|
return displayedData.map((entry: unknown, index): ScatterPointItem => {
|
|
837
849
|
const x = getValueByDataKey<unknown, number | string>(entry, xAxisDataKey);
|
|
838
850
|
const y = getValueByDataKey<unknown, number | string>(entry, yAxisDataKey);
|
|
839
851
|
const z: number | string = isNullish(zAxisDataKey)
|
|
840
852
|
? '-'
|
|
841
|
-
: getValueByDataKey<unknown, number | string>(entry, zAxisDataKey) ?? '-';
|
|
853
|
+
: (getValueByDataKey<unknown, number | string>(entry, zAxisDataKey) ?? '-');
|
|
842
854
|
|
|
843
855
|
const tooltipPayload: Array<TooltipPayloadEntry> = [
|
|
844
856
|
{
|
|
@@ -889,13 +901,11 @@ export function computeScatterPoints({
|
|
|
889
901
|
index,
|
|
890
902
|
dataKey: yAxisDataKey,
|
|
891
903
|
});
|
|
892
|
-
const size =
|
|
893
|
-
|
|
894
|
-
const radius =
|
|
895
|
-
size == null ? 0 : Math.sqrt(Math.max(size, 0) / Math.PI);
|
|
904
|
+
const size = z !== '-' && zAxis != null ? zAxis.scale.map(z) : defaultZ;
|
|
905
|
+
const radius = size == null ? 0 : Math.sqrt(Math.max(size, 0) / Math.PI);
|
|
896
906
|
|
|
897
907
|
return {
|
|
898
|
-
...entry as Record<string, unknown
|
|
908
|
+
...(entry as Record<string, unknown>),
|
|
899
909
|
cx,
|
|
900
910
|
cy,
|
|
901
911
|
x: cx == null ? undefined : cx - radius,
|
|
@@ -907,7 +917,7 @@ export function computeScatterPoints({
|
|
|
907
917
|
tooltipPayload,
|
|
908
918
|
tooltipPosition: cx == null || cy == null ? undefined : { x: cx, y: cy },
|
|
909
919
|
payload: entry,
|
|
910
|
-
...cells && cells[index] && cells[index].props as CellPropsFor<SVGPathElement
|
|
920
|
+
...(cells && cells[index] && (cells[index].props as CellPropsFor<SVGPathElement>)),
|
|
911
921
|
};
|
|
912
922
|
});
|
|
913
923
|
}
|
|
@@ -934,29 +944,32 @@ function ScatterWithId(props: InternalProps) {
|
|
|
934
944
|
const layerClass = clsx('recharts-scatter', className);
|
|
935
945
|
const clipPathId = id;
|
|
936
946
|
|
|
937
|
-
return
|
|
938
|
-
<
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
{needClip &&
|
|
944
|
-
<defs>
|
|
945
|
-
<GraphicalItemClipPath clipPathId={clipPathId} xAxisId={xAxisId} yAxisId={yAxisId} />
|
|
946
|
-
</defs>}
|
|
947
|
-
<SetErrorBarContext
|
|
948
|
-
xAxisId={xAxisId}
|
|
949
|
-
yAxisId={yAxisId}
|
|
950
|
-
data={points}
|
|
951
|
-
dataPointFormatter={errorBarDataPointFormatter}
|
|
952
|
-
errorBarOffset={0}
|
|
947
|
+
return (
|
|
948
|
+
<ZIndexLayer zIndex={props.zIndex}>
|
|
949
|
+
<Layer
|
|
950
|
+
className={layerClass}
|
|
951
|
+
clipPath={needClip ? `url(#clipPath-${clipPathId})` : undefined}
|
|
952
|
+
id={id}
|
|
953
953
|
>
|
|
954
|
-
|
|
955
|
-
<
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
954
|
+
{needClip && (
|
|
955
|
+
<defs>
|
|
956
|
+
<GraphicalItemClipPath clipPathId={clipPathId} xAxisId={xAxisId} yAxisId={yAxisId} />
|
|
957
|
+
</defs>
|
|
958
|
+
)}
|
|
959
|
+
<SetErrorBarContext
|
|
960
|
+
xAxisId={xAxisId}
|
|
961
|
+
yAxisId={yAxisId}
|
|
962
|
+
data={points}
|
|
963
|
+
dataPointFormatter={errorBarDataPointFormatter}
|
|
964
|
+
errorBarOffset={0}
|
|
965
|
+
>
|
|
966
|
+
<Layer key="recharts-scatter-symbols">
|
|
967
|
+
<SymbolsWithAnimation props={props} previousPointsRef={previousPointsRef} />
|
|
968
|
+
</Layer>
|
|
969
|
+
</SetErrorBarContext>
|
|
970
|
+
</Layer>
|
|
971
|
+
</ZIndexLayer>
|
|
972
|
+
);
|
|
960
973
|
}
|
|
961
974
|
|
|
962
975
|
export const defaultScatterProps = {
|
|
@@ -1007,37 +1020,39 @@ function ScatterImpl(props: WithIdRequired<Props>) {
|
|
|
1007
1020
|
if (needClip == null || points == null) {
|
|
1008
1021
|
return <CellsContext value={cellRegistry}>{props.children}</CellsContext>;
|
|
1009
1022
|
}
|
|
1010
|
-
return
|
|
1011
|
-
<
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1023
|
+
return (
|
|
1024
|
+
<CellsContext value={cellRegistry}>
|
|
1025
|
+
<SetScatterTooltipEntrySettings
|
|
1026
|
+
dataKey={props.dataKey}
|
|
1027
|
+
points={points}
|
|
1028
|
+
stroke={props.stroke}
|
|
1029
|
+
strokeWidth={props.strokeWidth}
|
|
1030
|
+
fill={props.fill}
|
|
1031
|
+
name={props.name}
|
|
1032
|
+
hide={props.hide}
|
|
1033
|
+
formatter={props.formatter}
|
|
1034
|
+
tooltipType={props.tooltipType}
|
|
1035
|
+
id={props.id}
|
|
1036
|
+
/>
|
|
1037
|
+
<ScatterWithId
|
|
1038
|
+
{...everythingElse}
|
|
1039
|
+
xAxisId={xAxisId}
|
|
1040
|
+
yAxisId={yAxisId}
|
|
1041
|
+
zAxisId={zAxisId}
|
|
1042
|
+
lineType={lineType}
|
|
1043
|
+
lineJointType={lineJointType}
|
|
1044
|
+
legendType={legendType}
|
|
1045
|
+
shape={shape}
|
|
1046
|
+
hide={hide}
|
|
1047
|
+
isAnimationActive={isAnimationActive}
|
|
1048
|
+
animationBegin={animationBegin}
|
|
1049
|
+
animationDuration={animationDuration}
|
|
1050
|
+
animationEasing={animationEasing}
|
|
1051
|
+
points={points}
|
|
1052
|
+
needClip={needClip}
|
|
1053
|
+
/>
|
|
1054
|
+
</CellsContext>
|
|
1055
|
+
);
|
|
1041
1056
|
}
|
|
1042
1057
|
|
|
1043
1058
|
function ScatterFn<DataPointType = any, ValueAxisType = any>(
|
|
@@ -1045,25 +1060,29 @@ function ScatterFn<DataPointType = any, ValueAxisType = any>(
|
|
|
1045
1060
|
) {
|
|
1046
1061
|
const props = resolveDefaultProps(outsideProps, defaultScatterProps);
|
|
1047
1062
|
const isPanorama = useIsPanorama();
|
|
1048
|
-
return
|
|
1049
|
-
{
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1063
|
+
return (
|
|
1064
|
+
<RegisterGraphicalItemId id={props.id} type="scatter">
|
|
1065
|
+
{(id) => (
|
|
1066
|
+
<>
|
|
1067
|
+
<SetLegendPayload legendPayload={computeLegendPayloadFromScatterProps(props)} />
|
|
1068
|
+
<SetCartesianGraphicalItem
|
|
1069
|
+
type="scatter"
|
|
1070
|
+
id={id}
|
|
1071
|
+
data={props.data}
|
|
1072
|
+
xAxisId={props.xAxisId}
|
|
1073
|
+
yAxisId={props.yAxisId}
|
|
1074
|
+
zAxisId={props.zAxisId}
|
|
1075
|
+
dataKey={props.dataKey}
|
|
1076
|
+
hide={props.hide}
|
|
1077
|
+
name={props.name}
|
|
1078
|
+
tooltipType={props.tooltipType}
|
|
1079
|
+
isPanorama={isPanorama}
|
|
1080
|
+
/>
|
|
1081
|
+
<ScatterImpl {...props} id={id} />
|
|
1082
|
+
</>
|
|
1083
|
+
)}
|
|
1084
|
+
</RegisterGraphicalItemId>
|
|
1085
|
+
);
|
|
1067
1086
|
}
|
|
1068
1087
|
|
|
1069
1088
|
/**
|
|
@@ -1072,8 +1091,7 @@ function ScatterFn<DataPointType = any, ValueAxisType = any>(
|
|
|
1072
1091
|
* @provides CellReader
|
|
1073
1092
|
* @consumes CartesianChartContext
|
|
1074
1093
|
*/
|
|
1075
|
-
export const Scatter = React.memo(ScatterFn, propsAreEqual) as
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
};
|
|
1094
|
+
export const Scatter = React.memo(ScatterFn, propsAreEqual) as typeof ScatterFn & {
|
|
1095
|
+
displayName?: string;
|
|
1096
|
+
};
|
|
1079
1097
|
Scatter.displayName = 'Scatter';
|