Docs/Cartesian Components/ErrorBar

ErrorBar

ErrorBar renders error whiskers on a graphical item (Bar, Line, or Scatter). It nests inside the item and reads error values from the data, drawing lines from the lower to upper bounds around each point.

import { Bar, BarChart, ErrorBar } from "solid-recharts";

<BarChart data={data}>
  <Bar dataKey="value" fill="#8884d8">
    <ErrorBar dataKey="error" width={5} stroke="#ff7300" />
  </Bar>
</BarChart>;
ErrorBar
error-bars.tsxOpen ↗
Loading source...

Props

PropTypeDefaultDescription
dataKeystring | number | function—Data field holding the error value(s) (required)
widthnumber5Whisker serif width in pixels
direction"x" | "y""y" (bar)Axis direction (Scatter only; inferred elsewhere)
strokestring"black"Whisker color
strokeWidthnumber | string1.5Whisker thickness
offsetnumber0Extra pixel offset applied to the whisker group
isAnimationActivebooleantrueAnimate whiskers on data change
animationDurationnumber400Animation duration (ms)
zIndexnumber—Stacking order

Notes

  • dataKey points to a data property containing either a single number (symmetric error) or an array [low, high] (asymmetric).
  • Whiskers are drawn from value - low to value + high on the appropriate axis.
  • ErrorBar must be a child of Bar, Line, or Scatter; it reads the parent's data context.
  • direction="x" requires the x-axis to be numeric (not categorical).
  • Set isAnimationActive={false} to render whiskers without animation.

See also

  • Bar — bar series (typically holds ErrorBar)
  • Line — line series
  • Scatter — scatter plot
  • BarChart — the chart container