-
- All Implemented Interfaces:
-
com.patrykandpatrick.vico.core.chart.insets.ChartInsetter,com.patrykandpatrick.vico.core.marker.Marker
public class MarkerComponent implements Marker
The default implementation of the Marker interface.
-
-
Field Summary
Fields Modifier and Type Field Description private FloatindicatorSizeDpprivate Function1<Integer, Unit>onApplyEntryColorprivate MarkerLabelFormatterlabelFormatterprivate final TextComponentlabelprivate final Componentindicatorprivate final LineComponentguideline
-
Constructor Summary
Constructors Constructor Description MarkerComponent(TextComponent label, Component indicator, LineComponent guideline)
-
Method Summary
Modifier and Type Method Description final FloatgetIndicatorSizeDp()The indicator size (in dp). final UnitsetIndicatorSizeDp(Float indicatorSizeDp)The indicator size (in dp). final Function1<Integer, Unit>getOnApplyEntryColor()An optional lambda function that allows for applying the color associated with a given data entry to a Component. final UnitsetOnApplyEntryColor(Function1<Integer, Unit> onApplyEntryColor)An optional lambda function that allows for applying the color associated with a given data entry to a Component. final MarkerLabelFormattergetLabelFormatter()The MarkerLabelFormatter for this marker. final UnitsetLabelFormatter(MarkerLabelFormatter labelFormatter)The MarkerLabelFormatter for this marker. final TextComponentgetLabel()final ComponentgetIndicator()final LineComponentgetGuideline()Unitdraw(DrawContext context, RectF bounds, List<Marker.EntryModel> markedEntries, ChartValuesProvider chartValuesProvider)Draws the marker. UnitgetInsets(MeasureContext context, Insets outInsets, HorizontalDimensions horizontalDimensions)Called during the measurement phase, before getHorizontalInsets. -
Methods inherited from class com.patrykandpatrick.vico.core.component.marker.MarkerComponent
draw -
Methods inherited from class com.patrykandpatrick.vico.core.marker.Marker
getHorizontalInsets -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
MarkerComponent
MarkerComponent(TextComponent label, Component indicator, LineComponent guideline)
- Parameters:
label- the TextComponent used to draw the label.indicator- an optional indicator drawn at a given point belonging to the data entry.guideline- an optional line drawn from the bottom of the chart to the bottom edge of the label.
-
-
Method Detail
-
getIndicatorSizeDp
final Float getIndicatorSizeDp()
The indicator size (in dp).
-
setIndicatorSizeDp
final Unit setIndicatorSizeDp(Float indicatorSizeDp)
The indicator size (in dp).
-
getOnApplyEntryColor
final Function1<Integer, Unit> getOnApplyEntryColor()
An optional lambda function that allows for applying the color associated with a given data entry to a Component.
-
setOnApplyEntryColor
final Unit setOnApplyEntryColor(Function1<Integer, Unit> onApplyEntryColor)
An optional lambda function that allows for applying the color associated with a given data entry to a Component.
-
getLabelFormatter
final MarkerLabelFormatter getLabelFormatter()
The MarkerLabelFormatter for this marker.
-
setLabelFormatter
final Unit setLabelFormatter(MarkerLabelFormatter labelFormatter)
The MarkerLabelFormatter for this marker.
-
getLabel
final TextComponent getLabel()
-
getIndicator
final Component getIndicator()
-
getGuideline
final LineComponent getGuideline()
-
draw
Unit draw(DrawContext context, RectF bounds, List<Marker.EntryModel> markedEntries, ChartValuesProvider chartValuesProvider)
Draws the marker.
- Parameters:
context- the DrawContext used to draw the marker.bounds- the bounds in which the marker is drawn.markedEntries- a list of EntryModels representing the entries to which the marker refers.chartValuesProvider- the Chart’s ChartValuesProvider.
-
getInsets
Unit getInsets(MeasureContext context, Insets outInsets, HorizontalDimensions horizontalDimensions)
Called during the measurement phase, before getHorizontalInsets. Both horizontal and vertical insets can be requested from this function. The final inset for a given edge of the associated Chart is the largest of the insets requested for the edge.
- Parameters:
context- holds data used for the measuring of components.outInsets- used to store the requested insets.horizontalDimensions- the associated Chart’s HorizontalDimensions.
-
-
-
-