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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassInternal class that represents visual element for grid line data element.static enumEnumeration that represents the horizontal location of the label relative to the grid line.static enumEnumeration that represents the vertical location of the label relative to the grid line.Nested classes/interfaces inherited from class com.amalgamasimulation.charts.visualsets.VisualSet
VisualSet.ContextMenuHandler<T>, VisualSet.UpdatePolicy, VisualSet.VisualElement -
Field Summary
Fields inherited from class com.amalgamasimulation.charts.visualsets.VisualSet
argumentExtractor, contentsToBeginArguments, contentsToEndArguments, contentsToVisualElements, contextMenuHandlers, dataElementsProvider, listeners, maxArgument, maxValueCache, minArgument, minValueCache, mouseEnterHandlers, mouseExitHandlers, mousePressedHandlers, mouseTransparent, name, needsUpdate, oldContentsList, tooltipTextExtractor, updatePolicy, visibilityChangeHandlers, visualElementsList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClipboardText(String object) Returns the text that will be copied to clipboard for the given object.getLabelColor(T element) Returns the grid line label color of the visual representing given data element.doublegetLabelFontSize(T element) Returns the grid line label font size of the visual representing given data element.getLabelText(T element) Returns the grid line label text of the visual representing given data element.getLabelTextPosition(T element) Returns the grid line labelAbstractGridLineVisualSet.GridLineLabelSideof the visual representing given data element.getLabelTextSide(T element) Returns the grid line labelAbstractGridLineVisualSet.GridLineLabelPositionof the visual representing given data element.getLineColor(T element) Returns the line color of the visual representing given data element.doublegetLineWidth(T element) Returns the line width in pixels of the visual representing given data element.getValue(double argument) Returns the Y-axis value for given X-axis argument.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.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.setLineColor(Function<T, Color> lineColorExtractor) Sets the line color of the lines representing plot data elements.setLineWidth(Function<T, Double> lineWidthExtractor) Sets the width of the grid lines representing plot data elements, in pixels.setTooltipText(Function<T, String> tooltipTextExtractor) Adds tooltip text to display when the mouse is hovered over a visual element representing given data element.Methods inherited from class com.amalgamasimulation.charts.visualsets.VisualSet
addContextMenuHandler, addMouseEnterHandler, addMouseExitHandler, addMousePressedHandler, addVisibilityChangeHandler, addVisualElement, addVisualElement, addVisualSetChangeHandler, clearDependencies, createVisualElement, getArgument, getContents, getContextMenuHandlers, getDataElements, getInjectionIndex, getMaxArgument, getMinArgument, getMouseEnterHandlers, getMouseExitHandlers, getMousePressedHandlers, getName, getTooltipText, getUpdatePolicy, getVisibilityChangeHandlers, getVisibleVisualElementIndex, getVisibleVisualElementsCount, getVisualElements, isMouseTransparent, isNeedsUpdate, recalculateVisualElements, removeContextMenuHandler, removeMouseEnterHandler, removeMouseExitHandler, removeMousePressedHandler, removeVisibilityChangeHandler, removeVisualElement, removeVisualSetChangeHandler, setMouseTransparent, setUpdatePolicy, sortVisualElements, toString, update, updateMinMaxArgumentsValues
-
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 chartdataElementsProvider- data elements list provider. The provider is invalidated every time the chart is beging redrawnargumentExtractor- a function that specifies the rule for extracting an argument from a data element
-
-
Method Details
-
setLineColor
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
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:
setClipboardTextin interfaceIClipboardTextPropertyOwner<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 labellabelFontSizeExtractor- the font size of the labellabelColorExtractor- the color of the labellabelTextPositionExtractor- theAbstractGridLineVisualSet.GridLineLabelPositionof the labellabelTextSideExtractor- theAbstractGridLineVisualSet.GridLineLabelSideof the label- Returns:
- reference to this object
-
getLineColor
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
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
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
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
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
Returns the grid line labelAbstractGridLineVisualSet.GridLineLabelPositionof the visual representing given data element.- Parameters:
element- data element for which the grid line labelAbstractGridLineVisualSet.GridLineLabelPositionis being checked- Returns:
- the grid line label
AbstractGridLineVisualSet.GridLineLabelPositionof the visual representing given data element
-
getLabelTextPosition
Returns the grid line labelAbstractGridLineVisualSet.GridLineLabelSideof the visual representing given data element.- Parameters:
element- data element for which the grid line labelAbstractGridLineVisualSet.GridLineLabelSideis being checked- Returns:
- the grid line label
AbstractGridLineVisualSet.GridLineLabelSideof the visual representing given data element
-
setTooltipText
Description copied from class:VisualSetAdds tooltip text to display when the mouse is hovered over a visual element representing given data element.- Specified by:
setTooltipTextin classVisualSet<T>- Parameters:
tooltipTextExtractor- a function that specifies the rule for extracting a tooltip text from a data element- Returns:
- reference to this object
-
getValue
Returns the Y-axis value for given X-axis argument.- Returns:
- the Y-axis value for given X-axis argument
-
getClipboardText
Description copied from interface:IClipboardTextPropertyOwnerReturns the text that will be copied to clipboard for the given object.- Specified by:
getClipboardTextin interfaceIClipboardTextPropertyOwner<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
-