Class XYTimeSeriesBuilder

java.lang.Object
com.jfcbuilder.builders.XYTimeSeriesBuilder
All Implemented Interfaces:
IXYTimeSeriesBuilder<XYTimeSeriesBuilder>

public class XYTimeSeriesBuilder extends Object implements IXYTimeSeriesBuilder<XYTimeSeriesBuilder>
Builder for producing TimeSeries instances from configured properties and source data.
  • Method Details

    • get

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

      public XYTimeSeriesBuilder name(String name)
      Description copied from interface: IXYTimeSeriesBuilder
      Sets the name associated with the series.
      Specified by:
      name in interface IXYTimeSeriesBuilder<XYTimeSeriesBuilder>
      Parameters:
      name - The name to be set
      Returns:
      Reference to this builder for chaining method calls
    • indexRange

      public XYTimeSeriesBuilder indexRange(ZeroBasedIndexRange indexRange)
      Description copied from interface: IXYTimeSeriesBuilder
      Sets zero-based data indexing range (start index and end index) to be used. By using this range, implementations can iterate over this particular sub-set of elements in the data array and clients do not have to copy their data simply to provide the proper set of data starting at index zero and ending at (length - 1). This should reduce memory usage and computational overhead.
      Specified by:
      indexRange in interface IXYTimeSeriesBuilder<XYTimeSeriesBuilder>
      Parameters:
      indexRange - The data array indexing range to be set
      Returns:
      Reference to this builder for chaining method calls
    • data

      public XYTimeSeriesBuilder data(double[] data)
      Description copied from interface: IXYTimeSeriesBuilder
      Sets the data value array to be plotted.
      Specified by:
      data in interface IXYTimeSeriesBuilder<XYTimeSeriesBuilder>
      Parameters:
      data - The value data to be set. Warning: this array's length must be equal to the length of the associated time series array set via ITimeSeriesBuilder.timeData(long[]). Failure to do so will result in undefined and possibly fatal behavior.
      Returns:
      Reference to this builder for chaining method calls
    • timeData

      public XYTimeSeriesBuilder timeData(long[] timeData)
      Description copied from interface: IXYTimeSeriesBuilder
      Sets the time data array associated with various other data to be plotted. The array should define all time instances in milliseconds since the epoch start.
      Specified by:
      timeData in interface IXYTimeSeriesBuilder<XYTimeSeriesBuilder>
      Parameters:
      timeData - The time data to be set. Warning: this array's length must be equal to the length of all other data to be plotted that will be associated with this time series. Failure to do so will result in undefined and possibly fatal behavior.
      Returns:
      Reference to this builder for chaining method calls
    • showTimeGaps

      public XYTimeSeriesBuilder showTimeGaps(boolean showTimeGaps)
      Description copied from interface: IXYTimeSeriesBuilder
      Toggle whether to show time gaps at x-values where there is no corresponding time instance.
      Specified by:
      showTimeGaps in interface IXYTimeSeriesBuilder<XYTimeSeriesBuilder>
      Parameters:
      showTimeGaps - True to show time gaps, false otherwise.
      Returns:
      Reference to this builder instance for method chaining
    • color

      public XYTimeSeriesBuilder color(Color color)
      Description copied from interface: IXYTimeSeriesBuilder
      Sets the color used to draw series that is built. This is not used explicitly by this builder but is associated with the built series so is cached in the builder as a convenience for lookup in a subsequent step after ITimeSeriesBuilder.build() is called.
      Specified by:
      color in interface IXYTimeSeriesBuilder<XYTimeSeriesBuilder>
      Parameters:
      color - The color to be used when the series is drawn
      Returns:
      Reference to this builder for chaining method calls
    • color

      public Color color()
      Description copied from interface: IXYTimeSeriesBuilder
      Gets the cached color to be used for drawing the series.
      Specified by:
      color in interface IXYTimeSeriesBuilder<XYTimeSeriesBuilder>
      Returns:
      The series drawing color
    • style

      public XYTimeSeriesBuilder style(Stroke stroke)
      Description copied from interface: IXYTimeSeriesBuilder
      Sets the Stroke ("style") used to draw series that is built. This is not used explicitly by this builder but is associated with the built series so is cached in the builder as a convenience for lookup in a subsequent step after ITimeSeriesBuilder.build() is called.
      Specified by:
      style in interface IXYTimeSeriesBuilder<XYTimeSeriesBuilder>
      Parameters:
      stroke - The stroke defining the XY line style to be used when the series is drawn
      Returns:
      Reference to this builder for chaining method calls
    • style

      public Stroke style()
      Description copied from interface: IXYTimeSeriesBuilder
      Gets the cached style to be used for drawing the series.
      Specified by:
      style in interface IXYTimeSeriesBuilder<XYTimeSeriesBuilder>
      Returns:
      The series drawing style
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • build

      public org.jfree.data.time.TimeSeries build() throws IllegalStateException
      Description copied from interface: IXYTimeSeriesBuilder
      Builds a new TimeSeries instance from all data and settings supplied to this builder.
      Specified by:
      build in interface IXYTimeSeriesBuilder<XYTimeSeriesBuilder>
      Returns:
      The new TimeSeries instance if successful
      Throws:
      IllegalStateException - If the builder was not setup adequately to properly create new TimeSeries instances