Class LineBarVisualSet<T>
java.lang.Object
com.amalgamasimulation.charts.visualsets.VisualSet<T>
com.amalgamasimulation.charts.visualsets.LineBarVisualSet<T>
- Type Parameters:
T- visual set data elements type
- All Implemented Interfaces:
IClipboardTextPropertyOwner<Double>,ILegendNodePropertiesOwner,IMinMaxValuePropertyOwner,IUpdatePolicyPropertyOwner,IAbstractChartVisualSet,ILineChartVisualSet
public class LineBarVisualSet<T>
extends VisualSet<T>
implements ILegendNodePropertiesOwner, IMinMaxValuePropertyOwner, IUpdatePolicyPropertyOwner, IClipboardTextPropertyOwner<Double>, ILineChartVisualSet
Visual set for drawing bars.
Can be drawn on AbstractLineChart.
Used to draw visuals corresponding to the statistical data. The bottom of the bar is always drawn at zero on the Y-axis and the top is at actual element value on the Y-axis.
- Author:
- Aleksey Kirillov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum represents the bar alignment i.e.classInternal class that represents visual element for bar data element.Nested classes/interfaces inherited from class com.amalgamasimulation.charts.visualsets.VisualSet
VisualSet.ContextMenuHandler<T>, VisualSet.UpdatePolicy, VisualSet.VisualElement -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LineBarVisualSet.BarAlignmentprotected Colorprotected 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 TypeMethodDescriptionaddContextMenuHandler(VisualSet.ContextMenuHandler<T> contextMenuHandler) Adds the action to be executed every time a context menu for given data element is called.addMouseEnterHandler(BiConsumer<T, javafx.scene.input.MouseEvent> handler) Adds the action to be executed every time mouse enters to any visual element borders.addMouseExitHandler(BiConsumer<T, javafx.scene.input.MouseEvent> handler) Adds the action to be executed every time the mouse exits the previously entered element's bounds.addMousePressedHandler(BiConsumer<T, javafx.scene.input.MouseEvent> handler) Adds the action to be executed every time a mouse button is pressed.addVisibilityChangeHandler(Consumer<VisibilityChangeDescriptor<? extends IAbstractChartVisualSet>> visibilityChangeHandler) Adds the action to be executed every time the visibility of this VisualSet is changed.createVisualElement(T contents) Creates a new instance ofVisualSet<T>.VisualElementcorresponding to the current VisualSet type.Returns the currentLineBarVisualSet.BarAlignment.Returns the bar color of the plot.doubleReturns the bar width of the plot, in pixels.getClipboardText(Double object) Returns the text that will be copied to clipboard for the given object.Returns the color of theLegend's icon corresponding to this VisualSetReturns theLegendlabel text represents this visual set.doubleReturns the maximum Y-axis value for all data elements.doubleReturns the minimum Y-axis value for all data elements.doublegetValue(double argument) Returns the value of the given X-axis argument.doubleReturns the value of the given data element.getVisualElements(boolean recalculationRequired) Returns the list of visual elements corresponding to current data elements.setBarAlignment(LineBarVisualSet.BarAlignment barAlignment) Sets theLineBarVisualSet.BarAlignmenti.e.setBarColor(Color barColor) Sets the fill color of the bar.setBarWidth(double barWidth) Sets the width of the bar, in pixels.setClipboardText(Function<Double, String> clipboardTextExtractor) Sets the conversion method from values of each plot data element into text that will be copied to clipboard.setLegendText(Supplier<String> legendTextProvider) Sets theLegendlabel text represents this visual set.setMouseTransparent(boolean mouseTransparent) Sets the value of the property mouseTransparent.setTooltipText(Function<T, String> tooltipTextExtractor) Adds tooltip text to display when the mouse is hovered over a visual element representing given data element.setUpdatePolicy(VisualSet.UpdatePolicy updatePolicy) Sets the newVisualSet.UpdatePolicyi.e.Methods inherited from class com.amalgamasimulation.charts.visualsets.VisualSet
addVisualElement, addVisualElement, addVisualSetChangeHandler, clearDependencies, getArgument, getContents, getContextMenuHandlers, getDataElements, getInjectionIndex, getMaxArgument, getMinArgument, getMouseEnterHandlers, getMouseExitHandlers, getMousePressedHandlers, getName, getTooltipText, getUpdatePolicy, getVisibilityChangeHandlers, getVisibleVisualElementIndex, getVisibleVisualElementsCount, isMouseTransparent, isNeedsUpdate, recalculateVisualElements, removeContextMenuHandler, removeMouseEnterHandler, removeMouseExitHandler, removeMousePressedHandler, removeVisibilityChangeHandler, removeVisualElement, removeVisualSetChangeHandler, 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.types.IAbstractChartVisualSet
addVisualSetChangeHandler, getContents, getMaxArgument, getMinArgument, getName, getUpdatePolicy, getVisibilityChangeHandlers, getVisibleVisualElementsCount, isMouseTransparent, removeVisibilityChangeHandler, removeVisualSetChangeHandlerMethods inherited from interface com.amalgamasimulation.charts.visualsets.IUpdatePolicyPropertyOwner
getUpdatePolicy
-
Field Details
-
barAlignment
-
barColor
-
barWidth
protected double barWidth -
valueExtractor
-
clipboardTextExtractor
-
legendTextProvider
-
-
Constructor Details
-
LineBarVisualSet
public LineBarVisualSet(String name, Supplier<List<T>> dataElementsProvider, Function<T, Double> argumentExtractor, Function<T, Double> valueExtractor) Constructs a LineBarVisualSet 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
-
setBarColor
Sets the fill color of the bar. Transparent and semi-transparent colors are allowed.- Parameters:
barColor- the bar fill color- Returns:
- reference to this object
-
setBarWidth
Sets the width of the bar, in pixels.- Parameters:
barWidth- the width of the bar, in pixels- Returns:
- reference to this object
-
setBarAlignment
Sets theLineBarVisualSet.BarAlignmenti.e. a way to draw bars relative to a grid line on the corresponding argument along the X-axis.- Parameters:
barAlignment- new way to draw bars relative to a grid line on the corresponding argument along the X-axis- Returns:
- the current
LineBarVisualSet.BarAlignment
-
getBarAlignment
Returns the currentLineBarVisualSet.BarAlignment.- Returns:
- the current
LineBarVisualSet.BarAlignment
-
getBarColor
Returns the bar color of the plot.- Returns:
- the bar color of the plot
-
getBarWidth
public double getBarWidth()Returns the bar width of the plot, in pixels.- Returns:
- the bar color of 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
-
setClipboardText
Description copied from interface:IClipboardTextPropertyOwnerSets the conversion method from values of each plot data element into text that will be copied to clipboard.- Specified by:
setClipboardTextin interfaceIClipboardTextPropertyOwner<T>- Parameters:
clipboardTextExtractor- an extractor that converts the value of each plot data element into text that will be copied to the clipboard- Returns:
- reference to this object
-
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
-
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
-
addContextMenuHandler
public LineBarVisualSet<T> addContextMenuHandler(VisualSet.ContextMenuHandler<T> contextMenuHandler) Description copied from class:VisualSetAdds the action to be executed every time a context menu for given data element is called.- Overrides:
addContextMenuHandlerin classVisualSet<T>- Parameters:
contextMenuHandler- context menu call action- Returns:
- reference to this object
-
addMouseEnterHandler
public LineBarVisualSet<T> addMouseEnterHandler(BiConsumer<T, javafx.scene.input.MouseEvent> handler) Description copied from class:VisualSetAdds the action to be executed every time mouse enters to any visual element borders.- Overrides:
addMouseEnterHandlerin classVisualSet<T>- Parameters:
handler- new mouse enter action- Returns:
- reference to this object
-
addMouseExitHandler
Description copied from class:VisualSetAdds the action to be executed every time the mouse exits the previously entered element's bounds.- Overrides:
addMouseExitHandlerin classVisualSet<T>- Parameters:
handler- new mouse exit action- Returns:
- reference to this object
-
addMousePressedHandler
public LineBarVisualSet<T> addMousePressedHandler(BiConsumer<T, javafx.scene.input.MouseEvent> handler) Description copied from class:VisualSetAdds the action to be executed every time a mouse button is pressed.- Overrides:
addMousePressedHandlerin classVisualSet<T>- Parameters:
handler- new mouse button pressed action- Returns:
- reference to this object
-
addVisibilityChangeHandler
public LineBarVisualSet<T> addVisibilityChangeHandler(Consumer<VisibilityChangeDescriptor<? extends IAbstractChartVisualSet>> visibilityChangeHandler) Description copied from interface:IAbstractChartVisualSetAdds the action to be executed every time the visibility of this VisualSet is changed.- Specified by:
addVisibilityChangeHandlerin interfaceIAbstractChartVisualSet- Overrides:
addVisibilityChangeHandlerin classVisualSet<T>- Parameters:
visibilityChangeHandler- visibility change action- Returns:
- reference to this object
-
setMouseTransparent
Description copied from interface:IAbstractChartVisualSetSets the value of the property mouseTransparent. If true, this VisualSet is completely transparent to mouse events. When choosing target for mouse event, VisualSets with mouseTransparent set to true won't be taken into account.- Specified by:
setMouseTransparentin interfaceIAbstractChartVisualSet- Overrides:
setMouseTransparentin classVisualSet<T>- Parameters:
mouseTransparent- new value of property mouseTransparent- Returns:
- reference to this object
-
setUpdatePolicy
Description copied from interface:IAbstractChartVisualSetSets the newVisualSet.UpdatePolicyi.e. the VisualSet update control rule.- Specified by:
setUpdatePolicyin interfaceIAbstractChartVisualSet- Specified by:
setUpdatePolicyin interfaceIUpdatePolicyPropertyOwner- Overrides:
setUpdatePolicyin classVisualSet<T>- Parameters:
updatePolicy- newVisualSet.UpdatePolicyi.e. the VisualSet update control rule- 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
-
getLegendText
Description copied from interface:ILegendNodePropertiesOwnerReturns theLegendlabel text represents this visual set.- Specified by:
getLegendTextin interfaceILegendNodePropertiesOwner- Returns:
- the
Legendlabel text represents this visual set
-
getValue
public double getValue(double argument) Returns the value of the given X-axis argument.- Parameters:
argument- X-axis argument for which the value is being checked- Returns:
- the value of the given X-axis argument
-
getVisualElements
public List<LineBarVisualSet<T>.LineBarVisualElement> getVisualElements(boolean recalculationRequired) Description copied from interface:IAbstractChartVisualSetReturns the list of visual elements corresponding to current data elements. Cannot be changed by the user.- Specified by:
getVisualElementsin interfaceIAbstractChartVisualSet- Specified by:
getVisualElementsin interfaceILineChartVisualSet- Overrides:
getVisualElementsin classVisualSet<T>- Parameters:
recalculationRequired- flag of the need to recalculate the visual elements- Returns:
- the list of visual elements corresponding to current data elements
-
createVisualElement
Description copied from class:VisualSetCreates a new instance ofVisualSet<T>.VisualElementcorresponding to the current VisualSet type.- Specified by:
createVisualElementin classVisualSet<T>- Parameters:
contents- data element for which theVisualSet<T>.VisualElementis being checked- Returns:
- a new instance of
VisualSet<T>.VisualElementcorresponding to the current VisualSet type
-
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 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
-