Error Bars
The error bars enable you to indicate the variability of the Chart data.
To display error bars, either:
- Bind specific high and low values from the data, or
- Configure the Chart to calculate the high and low values based on the series values.
Binding Specific Values
The binding of specific high and low values in the Charts requires different approaches when working with:
Categorical Charts
For categorical charts, you can bind the values by specifying the high and low fields from the data through the errorHighField
and errorLowField
options of the series.
The following example demonstrates how to bind the values for Categorical series.
Scatter Charts
For scatter charts, you can display error bars both for the X-axis and for the Y-axis values. To bind the values for the X axis, set the xErrorLowField
and xErrorHighField
options of the series. To bind the values for the Y axis, set the yErrorLowField
and yErrorHighField
options of the series.
The following example demonstrates how to bind the values for scatter series.
Calculating Values Based on Data
The Chart supports the calculation of the low and high values based on the point value.
To specify the way the values are calculated:
- For categorical charts, set the
errorBars.value
. - For scatter charts, set the
errorBars.xValue
anderrorBars.yValue
for scatter series, to one of the following values:
Numeric Values
The high and low values are calculated by adding or subtracting the value to the point value.
Array Values
The high and low values are calculated by adding the second element to and subtracting the first element from the point value.
Percentage Values
The high and low values are calculated by adding or subtracting the value to a percentage of the point value. To use percentage values, set a string value in the 'percentage(n)'
format where n
indicates the percentage.
Statistical Values
The error bars support statistical calculations based on the series data.
The available types are:
- Standard errors. To specify that a standard error will be used, set
"stderr"
as a value. - Population standard deviations. To use a standard deviation, set
"stddev"
with an optional number between parentheses appended at the end. The number will be multiplied by the calculated standard deviation value.
Custom Values
If you need a custom algorithm to calculate the high and low value, specify a function. The function is expected to return a valid error bar value and passes an object with the following fields:
dataItem