Class LabeledVisualSet<T>
java.lang.Object
com.amalgamasimulation.charts.visualsets.VisualSet<T>
com.amalgamasimulation.charts.visualsets.LabeledVisualSet<T>
- Type Parameters:
T- visual set data elements type
- All Implemented Interfaces:
IUpdatePolicyPropertyOwner,IAbstractChartVisualSet
- Direct Known Subclasses:
AbstractRegionVisualSet,GanttVisualSet,HeatmapVisualSet
Class that is the parent for all visual sets drawn on the chart by rectangles
with labels on it.
- Author:
- Aleksey Kirillov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassInternal class that represents visual element for labeled data element.Nested classes/interfaces inherited from class com.amalgamasimulation.charts.visualsets.VisualSet
VisualSet.ContextMenuHandler<T>, VisualSet.UpdatePolicy, VisualSet.VisualElement -
Field Summary
FieldsModifier and TypeFieldDescriptionFields 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 TypeMethodDescriptiongetLabelColor(T element, LabelSide labelSide) Returns the color of the label drawn for the specified data element andLabelSide.getLabelFontSize(T element, LabelSide labelSide) Returns the font size of the label drawn for the specified data element andLabelSide.Returns list of allLabelSidefor which at least one text label is specified.getLabelText(T element, LabelSide labelSide) Returns the text of the label drawn for the specified data element andLabelSide.setLabelText(LabelSide labelSide, Function<? extends T, String> labelTextExtractor, Function<? extends T, Double> labelFontSizeExtractor, Function<? extends T, Color> labelColorExtractor) Sets the labels of the rectangles representing plot data elements.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, updateMinMaxArgumentsValues
-
Field Details
-
labelTextExtractors
-
labelFontSizeExtractors
-
labelColorExtractors
-
labelTextSidesList
-
-
Constructor Details
-
LabeledVisualSet
public LabeledVisualSet(String name, Supplier<List<T>> dataElementsProvider, Function<T, Double> argumentExtractor) Constructs a LabeledVisualSet 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 being redrawnargumentExtractor- a function that specifies the rule for extracting an argument from a data element
-
-
Method Details
-
setLabelText
public LabeledVisualSet<T> setLabelText(LabelSide labelSide, Function<? extends T, String> labelTextExtractor, Function<? extends T, Double> labelFontSizeExtractor, Function<? extends T, Color> labelColorExtractor) Sets the labels of the rectangles representing plot data elements. The label of each rectangle is set independently of the labels on other sides of this rectangle or the labels on other rectangles. The label will not be displayed if the specified text is empty.- Parameters:
labelSide- theLabelSideof rectangle where the corresponding label will be drawnlabelTextExtractor- the text of the labellabelFontSizeExtractor- the font size of the labellabelColorExtractor- the color of the label- Returns:
- reference to this object
-
getLabelSides
Returns list of allLabelSidefor which at least one text label is specified.- Returns:
- list of all
LabelSidefor which at least one text label is specified
-
getLabelText
Returns the text of the label drawn for the specified data element andLabelSide. Returns an empty string if no label text is specified for the corresponding combination of parameters.- Parameters:
element- data element for which the label text is being checkedlabelSide- theLabelSideof rectangle where the corresponding label is drawn- Returns:
- the font size of the label drawn for the specified parameters, or empty string if no label text is specified for the corresponding combination of parameters
-
getLabelFontSize
Returns the font size of the label drawn for the specified data element andLabelSide. Returns a zero if no label text is specified for the corresponding combination of parameters.- Parameters:
element- data element for which the label font size is being checkedlabelSide- theLabelSideof rectangle where the corresponding label is drawn- Returns:
- the font size of the label drawn for the specified parameters, or zero if no label text is specified for the corresponding combination of parameters
-
getLabelColor
Returns the color of the label drawn for the specified data element andLabelSide. Returns a default white color if no label text is specified for the corresponding combination of parameters.- Parameters:
element- data element for which the label text is being checkedlabelSide- theLabelSideof rectangle where the corresponding label is drawn- Returns:
- the color of the label drawn for the specified parameters, or default white color if no label text is specified for the corresponding combination of parameters
-