Package com.castlabs.sdk.debug.metric
Class Metric
java.lang.Object
com.castlabs.sdk.debug.metric.Metric
- Direct Known Subclasses:
BandwidthMetric
,BufferAheadMetric
,BufferBehindMetric
,ChunkDownloadTimeMetric
,PlayingQualityMetric
,RateLimitMetric
,SelectedQualityMetric
Abstract class that provides the required underlying infrastructure to interact with the
PlayerMetricChart
and provide the necessary data to it.
You can create additional Metrics by extending this class. In addition to the abstract methods, you have access to the following:
-
addTimedDataPoint(float)
: Main data input. Use this method to add a data point to this metric. - dataSet: You can use this protected property to modify the underlying dataSet, right after calling the super constructor
-
Configuration overridable methods,
replicateLastValue()
,keepLastDroppedValue()
andextendToRightEdge()
.
- Since:
- 4.2.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Represents an object that can plot a metric. -
Constructor Summary
ConstructorDescriptionMetric
(int color, com.github.mikephil.charting.components.YAxis.AxisDependency axisDependency) -
Method Summary
Modifier and TypeMethodDescriptionvoid
attach
(Metric.Plotter plotter, PlayerController playerController) Attach this Metric to the given plotter and PlayerController.void
detach()
Unbind this Metric from the previously set PlayerController and Plotter.com.github.mikephil.charting.data.LineDataSet
Updates and returns the Data set ready to be drawn.
-
Constructor Details
-
Metric
public Metric(int color, com.github.mikephil.charting.components.YAxis.AxisDependency axisDependency) - Parameters:
color
- color that this Metric should be drawn inaxisDependency
- to which vertical axis bind the data from this Metric
-
-
Method Details
-
getDataSet
public com.github.mikephil.charting.data.LineDataSet getDataSet()Updates and returns the Data set ready to be drawn. Some other operations may happen here depending on the configuration of this Metric.- Returns:
- the
LineDataSet
ready to be drawn onto the graph.
-
attach
Attach this Metric to the given plotter and PlayerController.- Parameters:
plotter
- plotter that will handle drawing of this MetricplayerController
- PlayerController from where to extract the metric data
-
detach
public void detach()Unbind this Metric from the previously set PlayerController and Plotter.
-