Usage
Props
Decides how to extract the value of this ErrorBar from the data:
string: the name of the field in the data objectnumber: the index of the field in the datafunction: a function that receives the data object and returns the value of this ErrorBar
Width of the error bar ends (the serifs) in pixels.
This is not the total width of the error bar, but just the width of the little lines at the ends.The total width of the error bar is determined by the data value plus/minus the error value.
Direction of the error bar. Usually determined by chart layout, except in Scatter chart.
In Scatter chart, “x” means horizontal error bars, “y” means vertical error bars.
The stroke color. If “none”, no line will be drawn.
The width of the stroke.
Animation props
Whether to animate the error bars.
Specifies when the animation should begin, the unit of this option is ms.
Specifies the duration of animation, the unit of this option is ms.
The type of easing function.
Z-Index of this component.
Error data format
ErrorBar expects data in one of the following forms:Symmetric error bars
A single error value representing both lower and upper bounds.Asymmetric error bars
An array of two values representing lower and upper bounds separately. First value is the lower bound, second value is the upper bound.- For symmetric error bars:
[value - errorVal, value + errorVal] - For asymmetric error bars:
[value - errorVal[0], value + errorVal[1]]
Usage with different chart types
ErrorBar must be a child of a graphical element.With Line
With Bar
With Scatter
In Scatter charts, you can have error bars in both directions:Notes
In stacked or ranged Bar charts, ErrorBar will use the higher data value as the reference point for calculating the error bar positions.Source
https://github.com/recharts/recharts/blob/main/src/cartesian/ErrorBar.tsx