Package com.jfcbuilder.builders
Class XYArrowBuilder
java.lang.Object
com.jfcbuilder.builders.XYArrowBuilder
- All Implemented Interfaces:
IXYAnnotationBuilder<XYArrowBuilder>
Builder for producing
XYPointerAnnotation
(arrow) objects.-
Method Summary
Modifier and TypeMethodDescriptionangle
(double degrees) Sets the arrow's orientation angle in degrees.arrowLength
(double length) Sets the arrow length.org.jfree.chart.annotations.XYAnnotation
build()
Builds the XYAnnotation from all configured data and properties.Sets the arrow color.static XYArrowBuilder
get()
Factory method for obtaining new instances of this class.void
mapXToTimeIndex
(long[] timeData, int indexRangeStartIndex, int indexRangeEndIndex) UsesArrays.binarySearch()
to search the source array for the date value.Sets the arrow's texttextAlign
(org.jfree.chart.ui.TextAnchor alignment) Sets the anchor alignment method of the text.textPaddingLeft
(int n) Sets a number of padding space characters to insert to the left of the configured text.textPaddingRight
(int n) Sets a number of padding space characters to insert to the right of the configured text.tipRadius
(double radius) Sets the arrow tip's radius in Java2D units (effectively the tip size)double
x()
Gets the x-axis data coordinate that is set.x
(double x) Sets the arrow's x-axis data coordinate.double
y()
Gets the y-axis data coordinate that is set.y
(double y) Sets the arrow'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 arrow'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 arrow'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
-
angle
Sets the arrow's orientation angle in degrees.- Parameters:
degrees
- The angle to be set- Returns:
- Reference to this builder instance for method chaining
-
text
Sets the arrow's text- Parameters:
text
- The text to be set- Returns:
- Reference to this builder instance for method chaining
-
textPaddingLeft
Sets a number of padding space characters to insert to the left of the configured text.- Parameters:
n
- The number of padding characters- Returns:
- Reference to this builder instance for method chaining
-
textPaddingRight
Sets a number of padding space characters to insert to the right of the configured text.- Parameters:
n
- The number of padding characters- Returns:
- Reference to this builder instance for method chaining
-
textAlign
Sets the anchor alignment method of the text.- Parameters:
alignment
- The alignment anchor to use for the text- Returns:
- Reference to this builder instance for method chaining
- See Also:
-
XYTextAnnotation.setTextAnchor(TextAnchor)
-
color
Sets the arrow color.- Parameters:
color
- The color to be set- Returns:
- Reference to this builder instance for method chaining
-
arrowLength
Sets the arrow length.- Parameters:
length
- The length to be set in Java2D units- Returns:
- Reference to this builder instance for method chaining
- See Also:
-
XYPointerAnnotation.setBaseRadius(double)
-
tipRadius
Sets the arrow tip's radius in Java2D units (effectively the tip size)- Parameters:
radius
- The radius to be set in Java2D units- Returns:
- Reference to this builder instance for method chaining
- See Also:
-
XYPointerAnnotation.setTipRadius(double)
-
build
Description copied from interface:IXYAnnotationBuilder
Builds the XYAnnotation from all configured data and properties.- Specified by:
build
in interfaceIXYAnnotationBuilder<XYArrowBuilder>
- 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:
mapXToTimeIndex
in interfaceIXYAnnotationBuilder<XYArrowBuilder>
- Parameters:
timeData
- The array of source time valuesindexRangeStartIndex
- The start index of the series index rangeindexRangeEndIndex
- The end index of the series index range
-