Class BarLabeledVisualSet<T,C>
java.lang.Object
com.amalgamasimulation.visualsets.VisualSet<T>
com.amalgamasimulation.visualsets.BarLabeledVisualSet<T,C>
- Type Parameters:
T- visual set data elements typeC- data categories type
- All Implemented Interfaces:
IUpdatePolicyPropertyOwner,IAbstractChartVisualSet
- Direct Known Subclasses:
BarVisualSet,HistogramVisualSet
Class that is the parent for all visual sets drawn as bar charts with labels
on it.
- Author:
- Aleksey Kirillov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassInternal class that represents visual element for bar labeled data element.Nested classes/interfaces inherited from class com.amalgamasimulation.visualsets.VisualSet
VisualSet.ContextMenuHandler<T>, VisualSet.UpdatePolicy, VisualSet.VisualElement -
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class com.amalgamasimulation.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 TypeMethodDescriptiongetBarLabelColor(T element) Returns the bar label color for given data element.doublegetBarLabelFontSize(T element) Returns the bar label font size for given data element.getBarLabelText(T element) Returns the bar label text for given data element.getLabelColor(T element, C category, LabelSide labelSide) Returns the color of the label drawn for the specified data element, category, andLabelSide.doublegetLabelFontSize(T element, C category, LabelSide labelSide) Returns the font size of the label drawn for the specified data element, category, andLabelSide.Returns list of allLabelSidefor which at least one text label is specified.getLabelText(T element, C category, LabelSide labelSide) Returns the text of the label drawn for the specified data element, category, andLabelSide.setBarLabelColor(Function<T, Color> barLabelColorExtractor) Sets the label color for each visual element.setBarLabelFontSize(Function<T, Double> barLabelFontSizeExtractor) Sets the label font size for each visual element.setBarLabelText(Function<T, String> barLabelTextExtractor) Sets the label text for each visual element.setLabelText(LabelSide labelSide, BiFunction<T, C, String> labelTextExtractor, BiFunction<T, C, Double> labelFontSizeExtractor, BiFunction<T, C, Color> labelColorExtractor) Sets the labels of the bars representing plot data elements.Methods inherited from class com.amalgamasimulation.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, updateMinMaxArguments, updateMinMaxArgumentsValues
-
Field Details
-
barLabelTextExtractor
-
barLabelColorExtractor
-
barLabelFontSizeExtractor
-
labelTextExtractors
-
labelFontSizeExtractors
-
labelColorExtractors
-
-
Constructor Details
-
BarLabeledVisualSet
public BarLabeledVisualSet(String name, Supplier<List<T>> dataElementsProvider, Function<T, Double> argumentExtractor) Constructs a BarLabeledVisualSet 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 BarLabeledVisualSet<T,C> setLabelText(LabelSide labelSide, BiFunction<T, C, String> labelTextExtractor, BiFunction<T, C, Double> labelFontSizeExtractor, BiFunction<T, C, Color> labelColorExtractor) Sets the labels of the bars representing plot data elements. The label of each bar is set independently of the labels on other sides of this bar or the labels on other bars. The label will not be displayed if the specified text is empty.- Parameters:
labelSide- theLabelSideof bar 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
-
setBarLabelText
Sets the label text for each visual element. This label is displayed above the corresponding bars.- Parameters:
barLabelTextExtractor- the text of the bar label- Returns:
- reference to this object
-
setBarLabelFontSize
Sets the label font size for each visual element. This label is displayed above the corresponding bars.- Parameters:
barLabelFontSizeExtractor- the font size of the bar label- Returns:
- reference to this object
-
setBarLabelColor
Sets the label color for each visual element. This label is displayed above the corresponding bars.- Parameters:
barLabelColorExtractor- the color of the bar label- Returns:
- reference to this object
-
getBarLabelText
Returns the bar label text for given data element.- Parameters:
element- data element for which the bar label text is being checked- Returns:
- the bar label text for given data element.
-
getBarLabelFontSize
Returns the bar label font size for given data element.- Parameters:
element- data element for which the bar label font size is being checked- Returns:
- the bar label font size for given data element.
-
getBarLabelColor
Returns the bar label color for given data element.- Parameters:
element- data element for which the bar label color is being checked- Returns:
- the bar label color for given data element.
-
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, category, 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 checkedcategory- data category for which the label text is being checkedlabelSide- theLabelSideof bar 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, category, 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 checkedcategory- data category for which the label font size is being checkedlabelSide- theLabelSideof bar 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, category, 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 checkedcategory- data category for which the label text is being checkedlabelSide- theLabelSideof bar 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
-