Package com.jfcbuilder.builders
Class XYImageBuilder
java.lang.Object
com.jfcbuilder.builders.XYImageBuilder
- All Implemented Interfaces:
IXYAnnotationBuilder<XYImageBuilder>
Builder for producing
XYImageAnnotation objects.-
Method Summary
Modifier and TypeMethodDescriptionorg.jfree.chart.ui.RectangleAnchoranchor()Gets the image rectangle's position anchoranchor(org.jfree.chart.ui.RectangleAnchor anchor) Sets the image rectangle's position anchororg.jfree.chart.annotations.XYAnnotationbuild()Builds the XYAnnotation from all configured data and properties.static XYImageBuilderget()Factory method for obtaining new instances of this class.image()Gets theImageto be annotated.Sets theImageto be annotated.voidmapXToTimeIndex(long[] timeData, int indexRangeStartIndex, int indexRangeEndIndex) UsesArrays.binarySearch()to search the source array for the date value.doublex()Gets the x-axis data coordinate that is set.x(double x) Sets the image's x-axis data coordinate.doubley()Gets the y-axis data coordinate that is set.y(double y) Sets the image's y-axis data coordinate.
-
Method Details
-
get
Factory method for obtaining new instances of this class.- Returns:
- New instance of this class
-
x
Sets the image's x-axis data coordinate.- Parameters:
x- The data coordinate to set- Returns:
- Reference to this builder instance for method chaining
-
x
public double x()Gets the x-axis data coordinate that is set.- Returns:
- The data coordinate value
-
y
Sets the image's y-axis data coordinate.- Parameters:
y- The data coordinate to set- Returns:
- Reference to this builder instance for method chaining
-
y
public double y()Gets the y-axis data coordinate that is set.- Returns:
- The data coordinate value
-
image
Sets theImageto be annotated.- Parameters:
image- The image object to annotate- Returns:
- Reference to this builder instance for method chaining
-
image
Gets theImageto be annotated.- Returns:
- The image object to annotate
-
anchor
Sets the image rectangle's position anchor- Parameters:
anchor- The anchor to be set- Returns:
- Reference to this builder instance for method chaining
- See Also:
-
XYImageAnnotation.getImageAnchor()
-
anchor
public org.jfree.chart.ui.RectangleAnchor anchor()Gets the image rectangle's position anchor- Returns:
- The anchor
- See Also:
-
XYImageAnnotation.getImageAnchor()
-
build
Description copied from interface:IXYAnnotationBuilderBuilds the XYAnnotation from all configured data and properties.- Specified by:
buildin interfaceIXYAnnotationBuilder<XYImageBuilder>- 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()to search the source array for the date value. If found, replaces that value 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:
mapXToTimeIndexin interfaceIXYAnnotationBuilder<XYImageBuilder>- Parameters:
timeData- The array of source time valuesindexRangeStartIndex- The start index of the series index rangeindexRangeEndIndex- The end index of the series index range
-