Class XYDataImageBuilder

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

public class XYDataImageBuilder extends Object implements IXYAnnotationBuilder<XYDataImageBuilder>
Builder for producing XYDataImageAnnotation objects.

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

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    org.jfree.chart.annotations.XYAnnotation
    Builds the XYAnnotation from all configured data and properties.
    get()
    Factory method for obtaining new instances of this class.
    double
    Gets the data-space height of the image's drawing rectangle.
    height(double h)
    Sets the data-space height of the image's drawing rectangle.
    Gets the Image to be annotated.
    image(Image image)
    Sets the Image to be annotated.
    boolean
    Gets the "include in data bounds" flag.
    includeInDataBounds(boolean include)
    Sets the "include in data bounds" flag.
    void
    mapXToTimeIndex(long[] timeData, int indexRangeStartIndex, int indexRangeEndIndex)
    Helper mutation method for replacing the configured x-axis date values with corresponding source array element index value.
    double
    Gets the data-space width of the image's drawing rectangle.
    width(double w)
    Sets the data-space width of the image's drawing rectangle.
    double
    x()
    Gets the x-axis data coordinate that is set.
    x(double x)
    Sets the data image's x-axis data coordinate.
    double
    y()
    Gets the y-axis data coordinate that is set.
    y(double y)
    Sets the data image's y-axis data coordinate.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • get

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

      public XYDataImageBuilder x(double x)
      Sets the data 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

      public XYDataImageBuilder y(double y)
      Sets the data 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

      public XYDataImageBuilder image(Image image)
      Sets the Image to be annotated.
      Parameters:
      image - The image object to annotate
      Returns:
      Reference to this builder instance for method chaining
    • image

      public Image image()
      Gets the Image to be annotated.
      Returns:
      The image object to annotate
    • width

      public XYDataImageBuilder width(double w)
      Sets the data-space width of the image's drawing rectangle.
      Parameters:
      w - The width to be set
      Returns:
      Reference to this builder instance for method chaining
    • width

      public double width()
      Gets the data-space width of the image's drawing rectangle.
      Returns:
      The width
    • height

      public XYDataImageBuilder height(double h)
      Sets the data-space height of the image's drawing rectangle.
      Parameters:
      h - The width to be set
      Returns:
      Reference to this builder instance for method chaining
    • height

      public double height()
      Gets the data-space height of the image's drawing rectangle.
      Returns:
      The height
    • includeInDataBounds

      public XYDataImageBuilder includeInDataBounds(boolean include)
      Sets the "include in data bounds" flag.
      Parameters:
      include - True to enable the inclusion, false to disable it.
      Returns:
      Reference to this builder instance for method chaining
      See Also:
      • XYDataImageAnnotation.getIncludeInDataBounds()
    • includeInDataBounds

      public boolean includeInDataBounds()
      Gets the "include in data bounds" flag.
      Returns:
      True if including is enabled, false otherwise.
      See Also:
      • XYDataImageAnnotation.getIncludeInDataBounds()
    • 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<XYDataImageBuilder>
      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<XYDataImageBuilder>
      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