Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/recharts/recharts/llms.txt

Use this file to discover all available pages before exploring further.

Renders a set of symbols representing individual data points in a Scatter chart.

Usage

import { ScatterChart, Scatter, XAxis, YAxis } from 'recharts';

<ScatterChart width={600} height={300}>
  <XAxis dataKey="x" />
  <YAxis dataKey="y" />
  <Scatter data={data} fill="#8884d8" />
</ScatterChart>

Props

data
array
The source data which each element is an object.
dataKey
string | number | function
The key or getter function of a group of data.
fill
string
The fill color of symbols.
stroke
string
The stroke color of symbols.
strokeWidth
number | string
The width of the stroke.
shape
string | ReactElement | function
default:"circle"
Determines the shape of individual data points.
  • Can be one of the predefined shapes as a string: ‘circle’, ‘cross’, ‘diamond’, ‘square’, ‘star’, ‘triangle’, ‘wye’
  • If set a ReactElement, the shape of point can be customized
  • If set a function, the function will be called to render customized shape
activeShape
string | ReactElement | function
This component is rendered when this graphical item is activated (could be by mouse hover, touch, keyboard, programmatically).
line
boolean | object | ReactElement | function
default:"false"
Renders line connecting individual points. Options:
  • false: no line is drawn
  • true: a default line is drawn
  • ReactElement: the option is the custom line element
  • function: the function will be called to render customized line
  • object: the option is the props of Curve element
Also see the lineType prop which controls how is this line calculated.
lineType
'fitting' | 'joint'
default:"joint"
Determines calculation method of the line if the line prop is set. Options:
  • 'joint': line will be generated by connecting all the points
  • 'fitting': line will be generated by fitting algorithm (linear regression)
Has no effect if line prop is not set or is false.
lineJointType
CurveType
default:"linear"
Determines the shape of joint line. Same as type prop on Curve, Line and Area components.Has no effect if line prop is not set or is false or if lineType is ‘fitting’.
label
boolean | object | ReactElement | function
default:"false"
Renders one label for each data point. Options:
  • true: renders default labels
  • false: no labels are rendered
  • object: the props of LabelList component
  • ReactElement: a custom label element
  • function: a render function of custom label
hide
boolean
default:"false"
Hides the whole graphical element when true.Hiding an element is different from removing it from the chart: Hidden graphical elements are still visible in Legend, and can be included in axis domain calculations, depending on includeHidden props of your XAxis/YAxis.
name
string
The name of data. This option will be used in tooltip and legend to represent this graphical item. If no value was set to this option, the value of dataKey will be used alternatively.
xAxisId
string | number
default:"0"
The id of XAxis which is corresponding to the data. Required when there are multiple XAxes.
yAxisId
string | number
default:"0"
The id of YAxis which is corresponding to the data. Required when there are multiple YAxes.
zAxisId
string | number
default:"0"
The id of ZAxis which is corresponding to the data. Required when there are multiple ZAxes.ZAxis does not render directly, has no ticks and no tick line. It is used to control the size of each scatter point.
legendType
LegendType
default:"circle"
The type of icon in legend. If set to ‘none’, no legend item will be rendered.
tooltipType
TooltipType
The type of tooltip item.

Animation props

isAnimationActive
boolean | 'auto'
default:"auto"
If set false, animation of Scatter points will be disabled. If set “auto”, the animation will be disabled in SSR and will respect the user’s prefers-reduced-motion system preference for accessibility.
animationBegin
number
default:"0"
Specifies when the animation should begin, the unit of this option is ms.
animationDuration
number
default:"400"
Specifies the duration of animation, the unit of this option is ms.
animationEasing
AnimationTiming
default:"linear"
The type of easing function.

Layout props

id
string
Unique identifier of this component. Used as an HTML attribute id, and also to identify this element internally.If undefined, Recharts will generate a unique ID automatically.
zIndex
number
default:"600"
Z-Index of this component and its children. The higher the value, the more on top it will be rendered. Components with higher zIndex will appear in front of components with lower zIndex. If undefined or 0, the content is rendered in the default layer without portals.@since 3.4
className
string
CSS class name for styling.

Source

https://github.com/recharts/recharts/blob/main/src/cartesian/Scatter.tsx