Record Class ErrorBarPoint
java.lang.Object
java.lang.Record
com.arbergashi.charts.model.ErrorBarPoint
- All Implemented Interfaces:
Serializable
public record ErrorBarPoint(double x, double y, double errorLow, double errorHigh)
extends Record
implements Serializable
ErrorBarPoint - Type-Safe Statistical Data Point
Immutable record representing a data point with error bars or uncertainty range. Designed for scientific data, statistical analysis, and uncertainty visualization.
Usage Example:
// Create point with symmetric error bars
ErrorBarPoint point = ErrorBarPoint.symmetric(1.0, 100.0, 5.0);
// Create point with asymmetric error bars
ErrorBarPoint asymmetric = ErrorBarPoint.of(2.0, 100.0, 95.0, 108.0);
// Add to chart model
DefaultChartModel model = new DefaultChartModel("Temperature");
model.addWithError(point);
Field Mapping:
- x: X-axis value (time, category, independent variable)
- y: Y-axis value (measurement, mean, central value)
- errorLow: Lower bound of uncertainty range
- errorHigh: Upper bound of uncertainty range
- Since:
- 2026-01-16
- Version:
- 1.0.0
- Author:
- Arber Gashi
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionErrorBarPoint(double x, double y, double errorLow, double errorHigh) Validates error bar data integrity. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.doubleReturns the value of theerrorHighrecord component.doubleerrorLow()Returns the value of theerrorLowrecord component.final inthashCode()Returns a hash code value for this object.booleanReturns true if error bars are symmetric.doubleReturns the lower error margin (y - errorLow).static ErrorBarPointof(double x, double y, double errorLow, double errorHigh) Factory method for creating error bar points with asymmetric errors.doublerange()Returns the total uncertainty range (errorHigh - errorLow).static ErrorBarPointsymmetric(double x, double y, double error) Factory method for creating error bar points with symmetric errors.Converts to ChartPoint for internal rendering.final StringtoString()Returns a string representation of this record class.doubleReturns the upper error margin (errorHigh - y).static ErrorBarPointwithStdDev(double x, double mean, double stdDev, double sigmas) Factory method for creating error bar points with standard deviation.doublex()Returns the value of thexrecord component.doubley()Returns the value of theyrecord component.
-
Constructor Details
-
ErrorBarPoint
public ErrorBarPoint(double x, double y, double errorLow, double errorHigh) Validates error bar data integrity.
-
-
Method Details
-
of
Factory method for creating error bar points with asymmetric errors.- Parameters:
x- X-axis valuey- Y-axis value (central measurement)errorLow- Lower bound of uncertaintyerrorHigh- Upper bound of uncertainty- Returns:
- new ErrorBarPoint instance
-
symmetric
Factory method for creating error bar points with symmetric errors.- Parameters:
x- X-axis valuey- Y-axis value (central measurement)error- Symmetric error margin (±)- Returns:
- new ErrorBarPoint instance
-
withStdDev
Factory method for creating error bar points with standard deviation.- Parameters:
x- X-axis valuemean- Mean valuestdDev- Standard deviationsigmas- Number of standard deviations (e.g., 1.96 for 95% CI)- Returns:
- new ErrorBarPoint instance
-
toChartPoint
Converts to ChartPoint for internal rendering. Mapping: x→x, y→y, min→errorLow, max→errorHigh -
lowerError
public double lowerError()Returns the lower error margin (y - errorLow). -
upperError
public double upperError()Returns the upper error margin (errorHigh - y). -
range
public double range()Returns the total uncertainty range (errorHigh - errorLow). -
isSymmetric
public boolean isSymmetric()Returns true if error bars are symmetric. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
x
public double x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public double y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
errorLow
public double errorLow()Returns the value of theerrorLowrecord component.- Returns:
- the value of the
errorLowrecord component
-
errorHigh
public double errorHigh()Returns the value of theerrorHighrecord component.- Returns:
- the value of the
errorHighrecord component
-