Package com.jfcbuilder.builders
Class XYTitleBuilder
java.lang.Object
com.jfcbuilder.builders.XYTitleBuilder
- All Implemented Interfaces:
IXYAnnotationBuilder<XYTitleBuilder>
Builder for producing
XYTitleAnnotation objects.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.jfree.chart.ui.RectangleAnchorThe default text anchor position to use if none is specified.static final doubleThe default maximum height to use if none is specified.static final doubleThe default maximum width to use if none is specified.static final doubleThe default x-axis data coordinate to use if none is specified.static final doubleThe default y-axis data coordinate to use if none is specified. -
Method Summary
Modifier and TypeMethodDescriptionorg.jfree.chart.ui.RectangleAnchoranchor()Gets the title's position anchoranchor(org.jfree.chart.ui.RectangleAnchor a) Sets the title's position anchororg.jfree.chart.annotations.XYAnnotationbuild()Builds the XYAnnotation from all configured data and properties.static XYTitleBuilderget()Factory method for obtaining new instances of this class.voidmapXToTimeIndex(long[] timeData, int indexRangeStartIndex, int indexRangeEndIndex) Helper mutation method for replacing the configured x-axis date values with corresponding source array element index value.doubleGets the maximum height of the annotation.maxHeight(double h) Sets the maximum height of the annotation.doublemaxWidth()Gets the maximum width of the annotation.maxWidth(double w) Sets the maximum width of the annotation.org.jfree.chart.title.Titletitle()Gets theTitleto be annotated.title(org.jfree.chart.title.Title t) Sets theTitleto be annotated.doublex()Gets the x-coordinate of the annotation.x(double x) Sets the x-coordinate of the annotation.doubley()Gets the y-coordinate of the annotation.y(double y) Sets the y-coordinate of the annotation.
-
Field Details
-
DEFAULT_X_COORD
public static final double DEFAULT_X_COORDThe default x-axis data coordinate to use if none is specified.- See Also:
-
DEFAULT_Y_COORD
public static final double DEFAULT_Y_COORDThe default y-axis data coordinate to use if none is specified.- See Also:
-
DEFAULT_MAX_WIDTH
public static final double DEFAULT_MAX_WIDTHThe default maximum width to use if none is specified.- See Also:
-
DEFAULT_MAX_HEIGHT
public static final double DEFAULT_MAX_HEIGHTThe default maximum height to use if none is specified.- See Also:
-
DEFAULT_ANCHOR
public static final org.jfree.chart.ui.RectangleAnchor DEFAULT_ANCHORThe default text anchor position to use if none is specified.
-
-
Method Details
-
get
Factory method for obtaining new instances of this class.- Returns:
- New instance of this class
-
x
Sets the x-coordinate of the annotation.JFreeChart
XYTitleAnnotationhard-codes the coordinate type toXYCoordinateType.RELATIVEtherefore the X value being set must be in range (0.0, 1.0).- Parameters:
x- The coordinate value to be set. Should be in range (0.0, 1.0)- Returns:
- Reference to this builder instance for method chaining
-
x
public double x()Gets the x-coordinate of the annotation.- Returns:
- The x-coordinate
-
y
Sets the y-coordinate of the annotation.JFreeChart
XYTitleAnnotationhard-codes the coordinate type toXYCoordinateType.RELATIVEtherefore the Y value being set must be in range (0.0, 1.0).- Parameters:
y- The coordinate value to be set. Should be in range (0.0, 1.0)- Returns:
- Reference to this builder instance for method chaining
-
y
public double y()Gets the y-coordinate of the annotation.- Returns:
- The y-coordinate
-
maxWidth
Sets the maximum width of the annotation.- Parameters:
w- The width to set- Returns:
- Reference to this builder instance for method chaining
-
maxWidth
public double maxWidth()Gets the maximum width of the annotation.- Returns:
- The max width
-
maxHeight
Sets the maximum height of the annotation.- Parameters:
h- The height to set- Returns:
- Reference to this builder instance for method chaining
-
maxHeight
public double maxHeight()Gets the maximum height of the annotation.- Returns:
- The max height
-
title
Sets theTitleto be annotated.- Parameters:
t- The title to be set.- Returns:
- Reference to this builder instance for method chaining
-
title
public org.jfree.chart.title.Title title()Gets theTitleto be annotated.- Returns:
- The title
-
anchor
Sets the title's position anchor- Parameters:
a- The anchor to be set- Returns:
- Reference to this builder instance for method chaining
- See Also:
-
XYTitleAnnotation.getTitleAnchor()
-
anchor
public org.jfree.chart.ui.RectangleAnchor anchor()Gets the title's position anchor- Returns:
- The anchor
- See Also:
-
XYTitleAnnotation.getTitleAnchor()
-
build
Description copied from interface:IXYAnnotationBuilderBuilds the XYAnnotation from all configured data and properties.- Specified by:
buildin interfaceIXYAnnotationBuilder<XYTitleBuilder>- 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) Description copied from interface:IXYAnnotationBuilderHelper mutation method for replacing the configured x-axis date values with corresponding source array element index value.Meant to be called internally by the framework itself, not by framework clients.
For facilitating the removal of visible time gaps on charts.
Different implementations may use different methods to map configured x value(s) to numeric indices, including search algorithms that may have higher order Big-O complexity.
- Specified by:
mapXToTimeIndexin interfaceIXYAnnotationBuilder<XYTitleBuilder>- Parameters:
timeData- The array of source time valuesindexRangeStartIndex- The start index of the series index rangeindexRangeEndIndex- The end index of the series index range
-