Class AbstractGridLineVisualSet<T>

java.lang.Object
com.amalgamasimulation.charts.visualsets.VisualSet<T>
com.amalgamasimulation.charts.visualsets.AbstractGridLineVisualSet<T>
Type Parameters:
T - visual set data elements type
All Implemented Interfaces:
IClipboardTextPropertyOwner<String>, IUpdatePolicyPropertyOwner, IAbstractChartVisualSet
Direct Known Subclasses:
HorizontalGridLineVisualSet, VerticalGridLineVisualSet

public abstract class AbstractGridLineVisualSet<T> extends VisualSet<T> implements IClipboardTextPropertyOwner<String>
Class that is the parent for all visual sets drawn on the chart by either horizontal or vertical lines lines. Usually used to indicate some events on the time-related X-axis or some threshold values on the Y-axis.
Author:
Aleksey Kirillov
  • Constructor Details

    • AbstractGridLineVisualSet

      public AbstractGridLineVisualSet(String name, Supplier<List<T>> dataElementsProvider, Function<T,Double> argumentExtractor)
      Constructs a GridLineVisualSet with given name, data elements and arguments extractor, i.e. a function that specifies the rule for extracting an argument 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 beging redrawn
      argumentExtractor - a function that specifies the rule for extracting an argument from a data element
  • Method Details

    • setLineColor

      public AbstractGridLineVisualSet<T> setLineColor(Function<T,Color> lineColorExtractor)
      Sets the line color of the lines representing plot data elements. The color of each element is set independently of the color of other elements. Transparent and semi-transparent colors are allowed.
      Parameters:
      lineColorExtractor - new line color of the plot
      Returns:
      reference to this object
    • setLineWidth

      public AbstractGridLineVisualSet<T> setLineWidth(Function<T,Double> lineWidthExtractor)
      Sets the width of the grid lines representing plot data elements, in pixels. The width of each grid line is set independently of the width of other grid lines.
      Parameters:
      lineWidthExtractor - new line width of the plot, in pixels
      Returns:
      reference to this object
    • setClipboardText

      public AbstractGridLineVisualSet<T> setClipboardText(Function<String,String> clipboardTextExtractor)
      Sets the the conversion method from string representations of each plot value into text that will be copied to clipboard.
      Specified by:
      setClipboardText in interface IClipboardTextPropertyOwner<T>
      Parameters:
      clipboardTextExtractor - an extractor that converts the string representations of each plot data element into text that will be copied to the clipboard
      Returns:
      reference to this object
    • setLabelText

      public AbstractGridLineVisualSet<T> setLabelText(Function<T,String> labelTextExtractor, Function<T,Double> labelFontSizeExtractor, Function<T,Color> labelColorExtractor, Function<T,AbstractGridLineVisualSet.GridLineLabelPosition> labelTextPositionExtractor, Function<T,AbstractGridLineVisualSet.GridLineLabelSide> labelTextSideExtractor)
      Sets the labels of the grid lines representing plot data elements. The label of each grid line is set independently of the labels of other grid lines. The label will not be displayed if the specified text is empty.
      Parameters:
      labelTextExtractor - the text of the label
      labelFontSizeExtractor - the font size of the label
      labelColorExtractor - the color of the label
      labelTextPositionExtractor - the AbstractGridLineVisualSet.GridLineLabelPosition of the label
      labelTextSideExtractor - the AbstractGridLineVisualSet.GridLineLabelSide of the label
      Returns:
      reference to this object
    • getLineColor

      public Color getLineColor(T element)
      Returns the line color of the visual representing given data element.
      Parameters:
      element - data element for which the line color is being checked
      Returns:
      the line color of the visual representing given data element
    • getLineWidth

      public double getLineWidth(T element)
      Returns the line width in pixels of the visual representing given data element.
      Parameters:
      element - data element for which the line width in pixels is being checked
      Returns:
      the line width in pixels of the visual representing given data element
    • getLabelText

      public String getLabelText(T element)
      Returns the grid line label text of the visual representing given data element.
      Parameters:
      element - data element for which the grid line label text is being checked
      Returns:
      the grid line label text of the visual representing given data element
    • getLabelFontSize

      public double getLabelFontSize(T element)
      Returns the grid line label font size of the visual representing given data element.
      Parameters:
      element - data element for which the grid line label font size is being checked
      Returns:
      the grid line label font size of the visual representing given data element
    • getLabelColor

      public Color getLabelColor(T element)
      Returns the grid line label color of the visual representing given data element.
      Parameters:
      element - data element for which the grid line label color is being checked
      Returns:
      the grid line label color of the visual representing given data element
    • getLabelTextSide

      public AbstractGridLineVisualSet.GridLineLabelSide getLabelTextSide(T element)
      Returns the grid line label AbstractGridLineVisualSet.GridLineLabelPosition of the visual representing given data element.
      Parameters:
      element - data element for which the grid line label AbstractGridLineVisualSet.GridLineLabelPosition is being checked
      Returns:
      the grid line label AbstractGridLineVisualSet.GridLineLabelPosition of the visual representing given data element
    • getLabelTextPosition

      public AbstractGridLineVisualSet.GridLineLabelPosition getLabelTextPosition(T element)
      Returns the grid line label AbstractGridLineVisualSet.GridLineLabelSide of the visual representing given data element.
      Parameters:
      element - data element for which the grid line label AbstractGridLineVisualSet.GridLineLabelSide is being checked
      Returns:
      the grid line label AbstractGridLineVisualSet.GridLineLabelSide of the visual representing given data element
    • setTooltipText

      public AbstractGridLineVisualSet<T> setTooltipText(Function<T,String> tooltipTextExtractor)
      Description copied from class: VisualSet
      Adds tooltip text to display when the mouse is hovered over a visual element representing given data element.
      Specified by:
      setTooltipText in class VisualSet<T>
      Parameters:
      tooltipTextExtractor - a function that specifies the rule for extracting a tooltip text from a data element
      Returns:
      reference to this object
    • getValue

      public String getValue(double argument)
      Returns the Y-axis value for given X-axis argument.
      Returns:
      the Y-axis value for given X-axis argument
    • getClipboardText

      public String getClipboardText(String object)
      Description copied from interface: IClipboardTextPropertyOwner
      Returns the text that will be copied to clipboard for the given object.
      Specified by:
      getClipboardText in interface IClipboardTextPropertyOwner<T>
      Parameters:
      object - object for which the clipboard text is being checked
      Returns:
      the text that will be copied to clipboard for the given object