Package com.jfcbuilder.builders
Class XYTextBuilder
java.lang.Object
com.jfcbuilder.builders.XYTextBuilder
- All Implemented Interfaces:
IXYAnnotationBuilder<XYTextBuilder>
Builder for producing
XYTextAnnotation objects.-
Method Summary
Modifier and TypeMethodDescriptionangle(double degrees) Sets the text's orientation angle in degrees.org.jfree.chart.annotations.XYAnnotationbuild()Builds the XYAnnotation from all configured data and properties.Sets the text color.static XYTextBuilderget()Factory method for obtaining new instances of this class.voidmapXToTimeIndex(long[] timeData, int indexRangeStartIndex, int indexRangeEndIndex) UsesArrays.binarySearch()to search the source array for the date value.Sets the 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.doublex()Gets the x-axis data coordinate that is set.x(double x) Sets the text's x-axis data coordinate.doubley()Gets the y-axis data coordinate that is set.y(double y) Sets the text'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 text'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 text'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 text's orientation angle in degrees.- Parameters:
degrees- The angle to be set- Returns:
- Reference to this builder instance for method chaining
-
text
Sets the text- Parameters:
text- The text to be set- 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 text color.- Parameters:
color- The color to 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
-
build
Description copied from interface:IXYAnnotationBuilderBuilds the XYAnnotation from all configured data and properties.- Specified by:
buildin interfaceIXYAnnotationBuilder<XYTextBuilder>- 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<XYTextBuilder>- Parameters:
timeData- The array of source time valuesindexRangeStartIndex- The start index of the series index rangeindexRangeEndIndex- The end index of the series index range
-