Class PlayerMetricChart

java.lang.Object
android.view.View
android.view.ViewGroup
com.github.mikephil.charting.charts.Chart<T>
com.github.mikephil.charting.charts.BarLineChartBase<com.github.mikephil.charting.data.LineData>
com.github.mikephil.charting.charts.LineChart
com.castlabs.sdk.debug.view.PlayerMetricChart
All Implemented Interfaces:
Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback, ViewManager, ViewParent, Metric.Plotter, PlayerChart, com.github.mikephil.charting.interfaces.dataprovider.BarLineScatterCandleBubbleDataProvider, com.github.mikephil.charting.interfaces.dataprovider.ChartInterface, com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider

public class PlayerMetricChart extends com.github.mikephil.charting.charts.LineChart implements PlayerChart, Metric.Plotter
Chart that shows line graph displaying one or more Metrics.

By default no metrics are shown, so you should call enableMetrics(int) with the desired PlayerMetricChart.MetricTypes. You can also add metrics to plot with the addMetric(Metric) method.

*NOTE* that you must set the metrics before calling setPlayerController(PlayerController)

Since:
4.2.0
  • Field Details

  • Constructor Details

    • PlayerMetricChart

      public PlayerMetricChart(Context context)
    • PlayerMetricChart

      public PlayerMetricChart(Context context, AttributeSet attrs)
    • PlayerMetricChart

      public PlayerMetricChart(Context context, AttributeSet attrs, int defStyle)
  • Method Details

    • enableMetrics

      public void enableMetrics(int metrics)
      Enables the specified Metrics. Should be one or more of PlayerMetricChart.MetricType
      Parameters:
      metrics - Metrics to enable
    • isMetricEnabled

      public boolean isMetricEnabled(int metric)
      Whether a certain Metric is enabled or not
      Parameters:
      metric - the Metric to test
      Returns:
      whether the provided Metric is enabled or not
    • setRenderUpdateInterval

      public void setRenderUpdateInterval(int renderUpdateInterval)
      Adjust how often the View is redrawn
      Parameters:
      renderUpdateInterval - period between updates in milliseconds
    • showQualities

      public void showQualities()
      Enables Video qualities plotting. Same as calling showQualitiesAxis(YAxis.AxisDependency) with YAxis.AxisDependency.LEFT.
    • showQualitiesAxis

      public void showQualitiesAxis(@Nullable com.github.mikephil.charting.components.YAxis.AxisDependency axisDependency)
      Enables Video qualities plotting. This will overlay the video qualities as horizontal lines bound to the specified axis.
      Parameters:
      axisDependency - axis which to bound the qualities to.
    • addMetric

      public void addMetric(Metric metric)
      Adds a Metric to be drawn in this Chart.
      Parameters:
      metric - Metric to add
    • setPlayerController

      public void setPlayerController(@NonNull PlayerController playerController)
      Description copied from interface: PlayerChart
      Sets the player controller to which to bind and extract data from.
      Specified by:
      setPlayerController in interface PlayerChart
      Parameters:
      playerController - PlayerController where to get the data from.
    • unsetPlayerController

      public void unsetPlayerController()
      Description copied from interface: PlayerChart
      Performs all the necessary cleanup and removes the previously set listeners (if any).
      Specified by:
      unsetPlayerController in interface PlayerChart
    • requestPlot

      public void requestPlot(Metric metric)
      Description copied from interface: Metric.Plotter
      The metric needs to be redrawn. Probably due to data change
      Specified by:
      requestPlot in interface Metric.Plotter
      Parameters:
      metric - Metric to draw
    • getMaximumDataAgeMs

      public long getMaximumDataAgeMs()
      Description copied from interface: Metric.Plotter
      Maximum time data should be kept. Used to remove old data points.
      Specified by:
      getMaximumDataAgeMs in interface Metric.Plotter
      Returns:
      time data should be kept
    • setMaximumDataAgeMs

      public void setMaximumDataAgeMs(long maximumDataAgeMs)
      How much time the data should be kept and drawn.
      Parameters:
      maximumDataAgeMs - Maximum data age in milliseconds