public class

ChartFragment

extends Fragment
java.lang.Object
   ↳ Fragment
     ↳ com.shinobicontrols.charts.ChartFragment

Class Overview

Allows a chart to be placed inside an Android android.app.Fragment.

ChartFragment is a subclass of Fragment which contains the ShinobiChart object. Access to this object can be gained by calling getShinobiChart(); with this the chart can be configured and interacted with. Note, the ShinobiChart will only be available after onCreate(Bundle) has been called in this ChartFragment; before then getShinobiChart() will return null.

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. If subclassing ChartFragment this could be done in the onCreate(Bundle) method, for example. Note, this is only required in the trial version of shinobicharts for Android.

A ChartFragment manages the lifecycle of a chart to ensure optimum performance and can be specified directly in XML or in code. By default it (and therefore its ShinobiChart) is set to be retained across Activity re-creation.

It is possible to subclass ChartFragment though the superclass implementation of any overridden methods must be called first, before doing any work. You may, for example, want to override onCreate(Bundle) and add the code to initially set up your chart.

For applications that target pre-API level 12 Android devices and make use of the Android Support Library, use SupportChartFragment instead of this class.

Summary

Public Constructors
ChartFragment()
Public Methods
final ShinobiChart getShinobiChart()
Returns the ShinobiChart object contained in this fragment.
void onCreate(Bundle savedInstanceState)
Creates the ShinobiChart object held by the ChartFragment; before this point calling getShinobiChart() will return null.
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Sets the ShinobiChart up as the UI for the ChartFragment.
final void onDestroyView()
Manages how the ChartFragment's UI is destroyed.
void onPause()
Called when the fragment is no longer resumed.
void onResume()
Called when the fragment is visible to the user and actively running.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ChartFragment ()

Public Methods

public final ShinobiChart getShinobiChart ()

Returns the ShinobiChart object contained in this fragment.

Returns
  • The ShinobiChart object contained in this fragment

public void onCreate (Bundle savedInstanceState)

Creates the ShinobiChart object held by the ChartFragment; before this point calling getShinobiChart() will return null. By default the ChartFragment (and therefore its ShinobiChart) is set to be retained across Activity re-creation.

If subclassing ChartFragment, you may want to override this method and add the code to set your chart up. In that case, however, you must call the super implementation first before doing any work.

Parameters
savedInstanceState If the fragment is being re-created from a previous saved state, this is the state.

public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

Sets the ShinobiChart up as the UI for the ChartFragment. If overriding this method you must call the super implementation first.

public final void onDestroyView ()

Manages how the ChartFragment's UI is destroyed. This method cannot be overridden.

public void onPause ()

Called when the fragment is no longer resumed. If overriding this method you must call the super implementation first.

public void onResume ()

Called when the fragment is visible to the user and actively running. If overriding this method you must call the super implementation first.