ZAxis
ZAxis is used in ScatterChart to map a third data dimension (typically from a z
or size dataKey) to the radius or area of scatter dots, creating bubble charts. The
range prop controls the min and max bubble sizes.
import { ScatterChart, Scatter, XAxis, YAxis, ZAxis } from "solid-recharts";
<ScatterChart width={500} height={300} data={data}>
<XAxis dataKey="x" type="number" />
<YAxis dataKey="y" type="number" />
<ZAxis dataKey="z" range={[100, 1000]} />
<Scatter data={data} fill="#8884d8" />
</ScatterChart>;
Loading source...
Props
| Prop | Type | Default | Description |
|---|---|---|---|
dataKey | string | function | — | The key (or accessor function) for the bubble size data |
range | [number, number] | — | Min and max radius/area values for scaling bubbles |
zAxisId | string | number | 0 | Unique identifier (in case multiple scatter charts exist) |
type | "number" | "category" | "number" | Data type (always numeric for bubble sizing) |
domain | [number, number] | function | auto | Data domain for scaling; auto-detected if omitted |
scale | "linear" | "log" | … | "linear" | Scale algorithm for value-to-size mapping |
name | string | — | Axis name (shown in tooltips) |
unit | string | — | Unit label appended to tooltip values |
All other recharts ZAxis props are supported; see the recharts ZAxis
docs for the complete reference.
Notes
ZAxisdoes not render visual elements; it only registers size configuration for the scatter chart.- The
rangeprop is required to size bubbles; without it, all bubbles are the same size. range={[100, 1000]}means the smallest data value maps to radius 100, and the largest to radius 1000.- If
dataKeyis omitted, the ZAxis is ignored and scatter dots use theradiusprop.
See also
- ScatterChart — the container for scatter plots
- Scatter — the dot/bubble series component
- XAxis · YAxis — position axes