Class XYShapeBuilder

java.lang.Object
com.jfcbuilder.builders.XYShapeBuilder
All Implemented Interfaces:
IXYAnnotationBuilder<XYShapeBuilder>

public class XYShapeBuilder extends Object implements IXYAnnotationBuilder<XYShapeBuilder>
Builder for producing XYShapeAnnotation objects.

Note: Limited to working with DateAxis (i.e. with time gaps) mode only. See related comments in mapXToTimeIndex(long[], int, int)

See Also:
  • Field Details

    • DEFAULT_LINE_COLOR

      public static final Color DEFAULT_LINE_COLOR
      The default line color to use if none is specified.
    • DEFAULT_LINE_STYLE

      public static final Stroke DEFAULT_LINE_STYLE
      The default line style to use if none is specified.
    • DEFAULT_FILL_COLOR

      public static final Color DEFAULT_FILL_COLOR
      The default fill color to use if none is specified.
  • Method Details

    • get

      public static XYShapeBuilder get()
      Factory method for obtaining new instances of this class.
      Returns:
      New instance of this class
    • shape

      public Shape shape()
      Gets the Shape to be annotated.
      Returns:
      The shape
    • shape

      public XYShapeBuilder shape(Shape shape)
      Sets the Shape to be annotated.
      Parameters:
      shape - The Shape to be set
      Returns:
      Reference to this builder instance for method chaining
    • lineStyle

      public Stroke lineStyle()
      Gets the line style of the shape.
      Returns:
      The line style
    • lineStyle

      public XYShapeBuilder lineStyle(Stroke style)
      Sets the line style of the shape.
      Parameters:
      style - The style to be set
      Returns:
      Reference to this builder instance for method chaining
    • lineColor

      public Paint lineColor()
      Gets the line color of the shape.
      Returns:
      The color
    • lineColor

      public XYShapeBuilder lineColor(Paint color)
      Sets the line color of the shape.
      Parameters:
      color - The color to be set
      Returns:
      Reference to this builder instance for method chaining
    • fillColor

      public Paint fillColor()
      Gets the fill color of the shape.
      Returns:
      The color
    • fillColor

      public XYShapeBuilder fillColor(Paint color)
      Sets the fill color of the shape.
      Parameters:
      color - The color to be set
      Returns:
      Reference to this builder instance for method chaining
    • build

      public org.jfree.chart.annotations.XYAnnotation build() throws IllegalStateException
      Description copied from interface: IXYAnnotationBuilder
      Builds the XYAnnotation from all configured data and properties.
      Specified by:
      build in interface IXYAnnotationBuilder<XYShapeBuilder>
      Returns:
      New instance of an XYAnnotation corresponding to all configured data and properties
      Throws:
      IllegalStateException - If the builder is missing properties when build() is called
    • mapXToTimeIndex

      public void mapXToTimeIndex(long[] timeData, int indexRangeStartIndex, int indexRangeEndIndex)
      Description copied from interface: IXYAnnotationBuilder
      Helper 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:
      mapXToTimeIndex in interface IXYAnnotationBuilder<XYShapeBuilder>
      Parameters:
      timeData - The array of source time values
      indexRangeStartIndex - The start index of the series index range
      indexRangeEndIndex - The end index of the series index range