Class AbstractLineVisualSet<T>

java.lang.Object
com.amalgamasimulation.visualsets.VisualSet<T>
com.amalgamasimulation.visualsets.AbstractLineVisualSet<T>
Type Parameters:
T - visual set data elements type
All Implemented Interfaces:
ILegendNodePropertiesOwner, IMinMaxValuePropertyOwner, IUpdatePolicyPropertyOwner, IAbstractChartVisualSet
Direct Known Subclasses:
AbstractPolylineVisualSet, LineVisualSet

public abstract class AbstractLineVisualSet<T> extends VisualSet<T> implements IMinMaxValuePropertyOwner, IUpdatePolicyPropertyOwner, ILegendNodePropertiesOwner
Parent for all visual sets drawn on the chart by points and lines.
Author:
Aleksey Kirillov
  • Field Details

  • Constructor Details

    • AbstractLineVisualSet

      public AbstractLineVisualSet(String name, Supplier<List<T>> dataElementsProvider, Function<T,Double> argumentExtractor, Function<T,Double> valueExtractor)
      Constructs an AbstractLineVisualSet with given name, data elements and arguments/value extractors, i.e. a functions that specifies the rule for extracting an argument/value from a data element.
      Parameters:
      name - visual set name is used to sort and name the visual sets on the chart
      dataElementsProvider - data elements list provider. The provider is invalidated every time the chart is being redrawn
      argumentExtractor - a function that specifies the rule for extracting an argument from a data element
      valueExtractor - a function that specifies the rule for extracting a value from a data element
  • Method Details

    • setMaxValue

      public AbstractLineVisualSet<T> setMaxValue(Supplier<Double> maxValueProvider)
      Sets the supplier of max value. This value allows to set some "natural" max value of the data being displayed It will be used when scaling the Y-axis of the chart.
      Parameters:
      maxValueProvider - the supplier of max value
      Returns:
      reference to this object
    • setLineColor

      public AbstractLineVisualSet<T> setLineColor(Color lineColor)
      Sets the line color of the plot. Transparent and semi-transparent colors are allowed.
      Parameters:
      lineColor - the line color of the plot
      Returns:
      reference to this object
    • setLineWidth

      public AbstractLineVisualSet<T> setLineWidth(double lineWidth)
      Sets the width of the line, in pixels.
      Parameters:
      lineWidth - the width of the line, in pixels
      Returns:
      reference to this object
    • setPointSize

      public AbstractLineVisualSet<T> setPointSize(double pointSize)
      Sets the diameter of the point, in pixels.
      Parameters:
      pointSize - the diameter of the point, in pixels
      Returns:
      reference to this object
    • setPointsAndLinesStyle

      public AbstractLineVisualSet<T> setPointsAndLinesStyle(AbstractLineVisualSet.PointsAndLinesStyle pointsAndLinesStyle)
      Sets the AbstractLineVisualSet.PointsAndLinesStyle of the plot i.e. the methodology of drawing the visual elements for data elements.
      Parameters:
      pointsAndLinesStyle - the AbstractLineVisualSet.PointsAndLinesStyle of the plot i.e. the methodology of drawing the visual elements for data elements
      Returns:
      reference to this object
    • setLineStyle

      public AbstractLineVisualSet<T> setLineStyle(LineStyle lineStyle)
      Sets the LineStyle of the plot i.e. the methodology of drawing the lines for data elements.
      Parameters:
      lineStyle - the LineStyle of the plot i.e. the methodology of drawing the lines for data elements
      Returns:
      reference to this object
    • setExtrapolation

      public AbstractLineVisualSet<T> setExtrapolation(AbstractLineVisualSet.Extrapolation extrapolation)
      Sets the of the plot i.e. mode of extending a line to the maximum argument among all visual sets or to the current argument along the horizontal axis. Applicable only for AbstractLineVisualSet.
      Parameters:
      extrapolation - the AbstractLineVisualSet.Extrapolation of the plot
      Returns:
      reference to this object
    • setLegendText

      public AbstractLineVisualSet<T> setLegendText(Supplier<String> legendTextProvider)
      Description copied from interface: ILegendNodePropertiesOwner
      Sets the legend label text represents this visual set.
      Specified by:
      setLegendText in interface ILegendNodePropertiesOwner
      Parameters:
      legendTextProvider - the legend label text represents this visual set
      Returns:
      reference to this object
    • getExtrapolation

      public AbstractLineVisualSet.Extrapolation getExtrapolation()
      Returns the AbstractLineVisualSet.Extrapolation of the plot.
      Returns:
      the AbstractLineVisualSet.Extrapolation of the plot
    • getValue

      public double getValue(T element)
      Returns the value of the given data element.
      Parameters:
      element - data element for which the value is being checked
      Returns:
      the value of the given data element
    • getLineColor

      public Color getLineColor()
      Returns the line color of the plot.
      Returns:
      the line color of the plot
    • getLineWidth

      public double getLineWidth()
      Returns the line width of the plot, in pixels.
      Returns:
      the line color of the plot
    • getPointSize

      public double getPointSize()
      Returns the diameter of points of the plot, in pixels.
      Returns:
      the point diameter of the plot
    • getPointsAndLinesStyle

      public AbstractLineVisualSet.PointsAndLinesStyle getPointsAndLinesStyle()
      Returns:
      the AbstractLineVisualSet.PointsAndLinesStyle of the plot
    • getLineStyle

      public LineStyle getLineStyle()
      Returns the LineStyle of the plot.
      Returns:
      the LineStyle of the plot
    • getMinValue

      public double getMinValue()
      Description copied from interface: IMinMaxValuePropertyOwner
      Returns the minimum Y-axis value for all data elements. The minimum value is recalculated and cached at the moment the chart is redrawn. The method returns the value stored in the cache.
      Specified by:
      getMinValue in interface IMinMaxValuePropertyOwner
      Returns:
      the minimum Y-axis value for all data elements
      See Also:
    • getMaxValue

      public final double getMaxValue()
      Description copied from interface: IMinMaxValuePropertyOwner
      Returns the maximum Y-axis value for all data elements. The maximum value is recalculated and cached at the moment the chart is redrawn. The method returns the value stored in the cache.
      Specified by:
      getMaxValue in interface IMinMaxValuePropertyOwner
      Returns:
      the maximum Y-axis value for all data elements
      See Also:
    • getLegendColor

      public Color getLegendColor()
      Description copied from interface: ILegendNodePropertiesOwner
      Returns the color of the legend's icon corresponding to this VisualSet
      Specified by:
      getLegendColor in interface ILegendNodePropertiesOwner
      Returns:
      the color of the legend's icon corresponding to this VisualSet
    • getLegendText

      public String getLegendText()
      Description copied from interface: ILegendNodePropertiesOwner
      Returns the legend label text represents this visual set.
      Specified by:
      getLegendText in interface ILegendNodePropertiesOwner
      Returns:
      the legend label text represents this visual set
    • getValueMultiplier

      public double getValueMultiplier()
      Returns value multiplier for correct display on the chart.
      Returns:
      value multiplier for correct display on the chart
    • withValueMultiplier

      public AbstractLineVisualSet<T> withValueMultiplier(Supplier<Double> valueMultiplier)
      Sets value multiplier for correct display on the chart.
      Parameters:
      valueMultiplier - value multiplier for correct display on the chart
      Returns:
      reference to this object
    • getValueShift

      public double getValueShift()
      Returns value shift for correct display on the chart.
      Returns:
      value shift for correct display on the chart
    • withValueShift

      public AbstractLineVisualSet<T> withValueShift(Supplier<Double> valueShift)
      Sets value shift for correct display on the chart.
      Parameters:
      valueShift - value shift for correct display on the chart
      Returns:
      reference to this object