Docs/Cartesian Components/ReferenceArea

ReferenceArea

ReferenceArea draws a rectangle spanning a range of data coordinates. Use it to shade regions, represent acceptable ranges, or highlight time periods.

import { ReferenceArea, LineChart } from "solid-recharts";

<LineChart data={data}>
  <ReferenceArea y1={2000} y2={4000} fill="#ccc" fillOpacity={0.3} />
  <ReferenceArea x1="Jan" x2="Mar" fill="#8884d8" fillOpacity={0.1} />
</LineChart>;
ReferenceLine
reference-lines.tsxOpen ↗
Loading source...

Props

PropTypeDefaultDescription
x1number | string—Starting x-data coordinate; omit to extend to left edge
x2number | string—Ending x-data coordinate; omit to extend to right edge
y1number | string—Starting y-data coordinate; omit to extend to top edge
y2number | string—Ending y-data coordinate; omit to extend to bottom edge
fillstring"#ccc"Fill color
fillOpacitynumber0.5Fill transparency (0–1)
strokestring"none"Border color
strokeWidthnumber1Border thickness in pixels
ifOverflow"discard" | "hidden" | "extendDomain""discard"Behavior when the area exits the chart area
zIndexnumber—Stacking order (higher renders on top)

Notes

  • Omit x1/x2 to extend to the full horizontal range; same for y1/y2 and vertical.
  • Use fillOpacity (e.g., 0.2–0.4) to keep the area visible without obscuring data.
  • Set stroke="none" to remove the border; only the fill is visible.
  • ifOverflow="hidden" clips the area at the chart boundary.

See also