Class AbstractLineVisualSet<T>
java.lang.Object
com.amalgamasimulation.charts.visualsets.VisualSet<T>
com.amalgamasimulation.charts.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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassInternal class that represents visual element for line data element.static enumEnumeration defining extrapolation, i.e.static enumEnumeration defining whether to draw points, lines, both, or nothing for a line plot.Nested classes/interfaces inherited from class com.amalgamasimulation.charts.visualsets.VisualSet
VisualSet.ContextMenuHandler<T>, VisualSet.UpdatePolicy, VisualSet.VisualElement -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AbstractLineVisualSet.Extrapolationprotected Colorprotected LineStyleprotected doubleprotected doubleFields 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 TypeMethodDescriptionReturns theAbstractLineVisualSet.Extrapolationof the plot.Returns the color of theLegend's icon corresponding to this VisualSetReturns theLegendlabel text represents this visual set.Returns the line color of the plot.Returns theLineStyleof the plot.doubleReturns the line width of the plot, in pixels.final doubleReturns the maximum Y-axis value for all data elements.doubleReturns the minimum Y-axis value for all data elements.Returns theAbstractLineVisualSet.PointsAndLinesStyleof the plot.doubleReturns the diameter of points of the plot, in pixels.doubleReturns the value of the given data element.setExtrapolation(AbstractLineVisualSet.Extrapolation extrapolation) Sets the of the plot i.e.setLegendText(Supplier<String> legendTextProvider) Sets theLegendlabel text represents this visual set.setLineColor(Color lineColor) Sets the line color of the plot.setLineStyle(LineStyle lineStyle) Sets theLineStyleof the plot i.e.setLineWidth(double lineWidth) Sets the width of the line, in pixels.setMaxValue(Supplier<Double> maxValueProvider) Sets the supplier of max value.setPointsAndLinesStyle(AbstractLineVisualSet.PointsAndLinesStyle pointsAndLinesStyle) Sets theAbstractLineVisualSet.PointsAndLinesStyleof the plot i.e.setPointSize(double pointSize) Sets the diameter of the point, in pixels.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, setTooltipText, setUpdatePolicy, sortVisualElements, toString, update, updateMinMaxArgumentsValuesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.amalgamasimulation.charts.visualsets.IUpdatePolicyPropertyOwner
getUpdatePolicy, setUpdatePolicy
-
Field Details
-
lineColor
-
lineWidth
protected double lineWidth -
pointSize
protected double pointSize -
pointsAndLinesStyle
-
lineStyle
-
extrapolation
-
valueExtractor
-
maxValueProvider
-
legendTextProvider
-
-
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 chartdataElementsProvider- data elements list provider. The provider is invalidated every time the chart is being redrawnargumentExtractor- a function that specifies the rule for extracting an argument from a data elementvalueExtractor- a function that specifies the rule for extracting a value from a data element
-
-
Method Details
-
setMaxValue
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
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
Sets the width of the line, in pixels.- Parameters:
lineWidth- the width of the line, in pixels- Returns:
- reference to this object
-
setPointSize
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 theAbstractLineVisualSet.PointsAndLinesStyleof the plot i.e. the methodology of drawing the visual elements for data elements.- Parameters:
pointsAndLinesStyle- theAbstractLineVisualSet.PointsAndLinesStyleof the plot i.e. the methodology of drawing the visual elements for data elements- Returns:
- reference to this object
-
setLineStyle
Sets theLineStyleof the plot i.e. the methodology of drawing the lines for data elements.- Parameters:
lineStyle- theLineStyleof the plot i.e. the methodology of drawing the lines for data elements- Returns:
- reference to this object
-
setExtrapolation
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 forAbstractLineVisualSet.- Parameters:
extrapolation- theAbstractLineVisualSet.Extrapolationof the plot- Returns:
- reference to this object
-
setLegendText
Description copied from interface:ILegendNodePropertiesOwnerSets theLegendlabel text represents this visual set.- Specified by:
setLegendTextin interfaceILegendNodePropertiesOwner- Parameters:
legendTextProvider- theLegendlabel text represents this visual set- Returns:
- reference to this object
-
getExtrapolation
Returns theAbstractLineVisualSet.Extrapolationof the plot.- Returns:
- the
AbstractLineVisualSet.Extrapolationof the plot
-
getValue
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
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
Returns theAbstractLineVisualSet.PointsAndLinesStyleof the plot.- Returns:
- the
AbstractLineVisualSet.PointsAndLinesStyleof the plot
-
getLineStyle
Returns theLineStyleof the plot.- Returns:
- the
LineStyleof the plot
-
getMinValue
public double getMinValue()Description copied from interface:IMinMaxValuePropertyOwnerReturns 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:
getMinValuein interfaceIMinMaxValuePropertyOwner- Returns:
- the minimum Y-axis value for all data elements
- See Also:
-
getMaxValue
public final double getMaxValue()Description copied from interface:IMinMaxValuePropertyOwnerReturns 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:
getMaxValuein interfaceIMinMaxValuePropertyOwner- Returns:
- the maximum Y-axis value for all data elements
- See Also:
-
getLegendColor
Description copied from interface:ILegendNodePropertiesOwnerReturns the color of theLegend's icon corresponding to this VisualSet- Specified by:
getLegendColorin interfaceILegendNodePropertiesOwner- Returns:
- the color of the
Legend's icon corresponding to this VisualSet
-
getLegendText
Description copied from interface:ILegendNodePropertiesOwnerReturns theLegendlabel text represents this visual set.- Specified by:
getLegendTextin interfaceILegendNodePropertiesOwner- Returns:
- the
Legendlabel text represents this visual set
-