public class

ChartView

extends FrameLayout
java.lang.Object
   ↳ FrameLayout
     ↳ com.shinobicontrols.charts.ChartView

Class Overview

Allows a chart to be placed inside an Android android.view.View.

ChartView is a subclass of View; it can be added to a parent layout (see android.view.ViewGroup) and can be specified directly in XML or in code.

It contains the ShinobiChart object from which the chart can be configured and interacted with. Access to this object can be gained by calling getShinobiChart(). In the trial version of the library, a trial license key must be supplied to the chart using its setLicenseKey(String) method before it is drawn. This could be done in the containing Activity's onCreate() method, for example. Note, this is only required in the trial version of shinobicharts for Android.

It is essential that lifecycle callbacks from the android.app.Activity this ChartView is hosted in are forwarded through to it. Not doing so will significantly impact the performance of the chart. The lifecycle callbacks which should be forwarded to the ChartView are: onCreate(Bundle), onDestroy(), onPause() and onResume().

Using ChartFragment or SupportChartFragment will create a self-contained chart inside a fragment and automatically handles lifecycle callbacks.

Summary

Public Constructors
ChartView(Context context)
Simple constructor to use when creating a ChartView from code.
ChartView(Context context, AttributeSet attrs)
Constructor that is called when inflating a ChartView from XML.
ChartView(Context context, AttributeSet attrs, int defStyle)
Inflates a ChartView from XML and applies a class-specific base style.
Public Methods
final ShinobiChart getShinobiChart()
Returns the ShinobiChart object contained in this view.
final void onCreate(Bundle savedInstanceState)
This method must be called from the parent Activity or Fragment's corresponding method.
final void onDestroy()
This method must be called from the parent Activity or Fragment's corresponding method.
void onPause()
This method must be called from the parent Activity or Fragment's corresponding method.
void onResume()
This method must be called from the parent Activity or Fragment's corresponding method.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ChartView (Context context)

Simple constructor to use when creating a ChartView from code.

Parameters
context The android.content.Context the chart view is running in, through which it can access the current theme, resources, etc.

public ChartView (Context context, AttributeSet attrs)

Constructor that is called when inflating a ChartView from XML. This is called when a chart view is being constructed from an XML file, supplying attributes that were specified in the XML file. This version uses a default style of 0, so the only attribute values applied are those in the Context's Theme and the given AttributeSet.

Parameters
context The Context the chart view is running in, through which it can access the current theme, resources, etc.
attrs The attributes of the ChartView XML tag that is inflating the chart view

public ChartView (Context context, AttributeSet attrs, int defStyle)

Inflates a ChartView from XML and applies a class-specific base style. This constructor of ChartView allows subclasses to use their own base style when they are inflating (see android.view.View#View(Context, AttributeSet, int).

Parameters
context The Context the chart view is running in, through which it can access the current theme, resources, etc.
attrs The attributes of the ChartView XML tag that is inflating the chart view
defStyle The default style to apply to this chart view. If 0, no style will be applied (beyond what is included in the theme). This may either be an attribute resource, whose value will be retrieved from the current theme, or an explicit style resource.

Public Methods

public final ShinobiChart getShinobiChart ()

Returns the ShinobiChart object contained in this view.

Returns
  • The ShinobiChart object contained in this view

public final void onCreate (Bundle savedInstanceState)

This method must be called from the parent Activity or Fragment's corresponding method.

Parameters
savedInstanceState When being re-initialized, this is the data the Activity most recently supplied in onSaveInstanceState(Bundle).

public final void onDestroy ()

This method must be called from the parent Activity or Fragment's corresponding method.

public void onPause ()

This method must be called from the parent Activity or Fragment's corresponding method.

public void onResume ()

This method must be called from the parent Activity or Fragment's corresponding method.