Package com.jfcbuilder.builders
Class XYLineBuilder
java.lang.Object
com.jfcbuilder.builders.XYLineBuilder
- All Implemented Interfaces:
IXYAnnotationBuilder<XYLineBuilder>
Builder for producing
XYLineAnnotation
objects.-
Method Summary
Modifier and TypeMethodDescriptionorg.jfree.chart.annotations.XYAnnotation
build()
Builds the XYAnnotation from all configured data and properties.color()
Gets the line's color.Sets the line's color.static XYLineBuilder
get()
Factory method for obtaining new instances of this class.void
mapXToTimeIndex
(long[] timeData, int indexRangeStartIndex, int indexRangeEndIndex) UsesArrays.binarySearch()
two times to search the source array for the x1 and x2 date value.style()
Gets the line's style.Sets the line's style.double
x1()
Gets the x-axis data coordinate of the line's first point.x1
(double x1) Sets the x-axis data coordinate of the line's first point.double
x2()
Gets the x-axis data coordinate of the line's second point.x2
(double x2) Sets the x-axis data coordinate of the line's second point.double
y1()
Gets the y-axis data coordinate of the line's first point.y1
(double y1) Sets the y-axis data coordinate of the line's first point.double
y2()
Gets the y-axis data coordinate of the line's second point.y2
(double y2) Sets the y-axis data coordinate of the line's second point.
-
Method Details
-
get
Factory method for obtaining new instances of this class.- Returns:
- New instance of this class
-
x1
public double x1()Gets the x-axis data coordinate of the line's first point.- Returns:
- The data coordinate value
-
x1
Sets the x-axis data coordinate of the line's first point.- Parameters:
x1
- The data coordinate to set- Returns:
- Reference to this builder instance for method chaining
-
y1
public double y1()Gets the y-axis data coordinate of the line's first point.- Returns:
- The data coordinate value
-
y1
Sets the y-axis data coordinate of the line's first point.- Parameters:
y1
- The data coordinate to set- Returns:
- Reference to this builder instance for method chaining
-
x2
public double x2()Gets the x-axis data coordinate of the line's second point.- Returns:
- The data coordinate value
-
x2
Sets the x-axis data coordinate of the line's second point.- Parameters:
x2
- The data coordinate to set- Returns:
- Reference to this builder instance for method chaining
-
y2
public double y2()Gets the y-axis data coordinate of the line's second point.- Returns:
- The data coordinate value
-
y2
Sets the y-axis data coordinate of the line's second point.- Parameters:
y2
- The data coordinate to set- Returns:
- Reference to this builder instance for method chaining
-
style
Gets the line's style.- Returns:
- The style
-
style
Sets the line's style.- Parameters:
style
- The style to set- Returns:
- Reference to this builder instance for method chaining
-
color
Gets the line's color.- Returns:
- The color
-
color
Sets the line's color.- Parameters:
color
- The color to set- Returns:
- Reference to this builder instance for method chaining
-
build
Description copied from interface:IXYAnnotationBuilder
Builds the XYAnnotation from all configured data and properties.- Specified by:
build
in interfaceIXYAnnotationBuilder<XYLineBuilder>
- Returns:
- New instance of an XYAnnotation corresponding to all configured data and properties
- Throws:
IllegalStateException
- If the builder is missing properties whenbuild()
is called
-
mapXToTimeIndex
public void mapXToTimeIndex(long[] timeData, int indexRangeStartIndex, int indexRangeEndIndex) UsesArrays.binarySearch()
two times to search the source array for the x1 and x2 date value. If found, replaces the values in the builder with the found array index relative to the configured index range. The source time values are assumed to be timestamps in milliseconds since the epoch start. It's also assumed these are in ascending chronologic order. Failure to provide them in sorted order will result in undefined behavior as perArrays.binarySearch()
.- Specified by:
mapXToTimeIndex
in interfaceIXYAnnotationBuilder<XYLineBuilder>
- Parameters:
timeData
- The array of source time valuesindexRangeStartIndex
- The start index of the series index rangeindexRangeEndIndex
- The end index of the series index range
-