ScatterChart component displays data points on a two-dimensional plot. It’s ideal for showing relationships between two variables or identifying patterns and outliers.
Basic scatter chart
Unlike other charts,
ScatterChart requires numeric type="number" on both axes and uses dataKey on the axes to specify which fields to plot.Multiple scatter series
Custom shape
Variable point sizes with ZAxis
ZAxis controls the size of scatter points. The range prop defines the minimum and maximum sizes.With reference lines
Joint line scatter
Set
line={true} to connect the scatter points with lines.Custom active shape
Scatter with labels
Domain and range customization
Common pitfalls
- Axis type: Both X and Y axes must use
type="number"for scatter charts. - Data structure: Each data point should have properties matching the
dataKeyspecified on both axes. - Missing data: Unlike line charts, scatter plots don’t interpolate missing values. Each point must have both x and y values.
- Tooltip event type: ScatterChart only supports
'item'tooltip event type. - ZAxis range: When using ZAxis for point sizing, ensure the
rangevalues are appropriate for your design.