# Class SeriesTransition

java.lang.Object
com.codename1.charts.transitions.SeriesTransition

All Implemented Interfaces:
  `Animation`

Direct Known Subclasses:
  `XYMultiSeriesTransition, XYSeriesTransition, XYValueSeriesTransition`

public abstract class SeriesTransition extends Object implements Animation
A base class for series transitions of ChartComponent. This should be overridden by concrete classes that implement the update(int) method to update the chart's model and renderer appropriately. This class can serve as a buffer for changes to the model so that they don't affect the ChartComponent immediately. Changes can either be eased in using animateChart() or updated in one shot using updateChart().

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `EASING_IN`
  `static final int`
  `EASING_IN_OUT`
  `static final int`
  `EASING_LINEAR`
  `static final int`
  `EASING_OUT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SeriesTransition(ChartComponent chart)`
  `SeriesTransition(ChartComponent chart, int easing)`
  `SeriesTransition(ChartComponent chart, int easing, int duration)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `animate()`
  Allows the animation to reduce "repaint" calls when it returns false.
  `void`
  `animateChart()`
  Applies all pending changes to the chart model and renderer using the current animation settings.
  `protected void`
  `cleanup()`
  Cleans up any settings in the transition.
  `ChartComponent`
  `getChart()`
  Gets the ChartComponent that is the subject of the transition.
  `int`
  `getDuration()`
  Gets the duration of the transition.
  `int`
  `getEasing()`
  Gets the type of easing used in the transition.
  `protected void`
  `initTransition()`
  Initializes the transition for another iteration.
  `void`
  `paint(Graphics g)`
  Draws the animation, within a component the standard paint method would be invoked since it bares the exact same signature.
  `void`
  `setChart(ChartComponent chart)`
  Sets the ChartComponent that is the subject of the transition.
  `void`
  `setDuration(int duration)`
  Sets the duration of the transition in milliseconds.
  `void`
  `setEasing(int easing)`
  Sets the type of easing used in the transition.
  `protected abstract void`
  `update(int progress)`
  Updates the renderer and model at the specified progress position of the animation.
  `void`
  `updateChart()`
  Applies all pending changes to the chart model and renderer and repaints the chart.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### EASING_LINEAR

    public static final int EASING_LINEAR
    See Also:
      - Constant Field Values

  - ### EASING_IN

    public static final int EASING_IN
    See Also:
      - Constant Field Values

  - ### EASING_OUT

    public static final int EASING_OUT
    See Also:
      - Constant Field Values

  - ### EASING_IN_OUT

    public static final int EASING_IN_OUT
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SeriesTransition

    public SeriesTransition(ChartComponent chart)

  - ### SeriesTransition

    public SeriesTransition(ChartComponent chart, int easing)

  - ### SeriesTransition

    public SeriesTransition(ChartComponent chart, int easing, int duration)

- ## Method Details

  - ### initTransition

    protected void initTransition()
    Initializes the transition for another iteration. This can be overridden by subclasses to provide their own initialization. This method will be called just prior to the transition taking place. IMPORTANT: Subclasses must make sure to call super.initTransition() so that the animation will be initialized properly.

  - ### cleanup

    protected void cleanup()
    Cleans up any settings in the transition. Called after a transition is complete. This is meant to be overridden by subclasses.

  - ### update

    protected abstract void update(int progress)

    Updates the renderer and model at the specified progress position of the animation. Meant to be overridden by subclasses.

    ###### Parameters

    - `progress`: The progress of the animation (between 0 and 100).

  - ### animate

    public boolean animate()
    Description copied from interface: `Animation`

    Allows the animation to reduce "repaint" calls when it returns false. It is called once for every frame. Frames are defined by the `com.codename1.ui.Display` class.

    ###### Returns

    true if a repaint is desired or false if no repaint is necessary

    Specified by:
      `animate` in interface `Animation`

  - ### paint

    public void paint(Graphics g)
    Description copied from interface: `Animation`

    Draws the animation, within a component the standard paint method would be invoked since it bares the exact same signature.

    ###### Parameters

    - `g`: graphics context
    Specified by:
      `paint` in interface `Animation`

  - ### getChart

    public ChartComponent getChart()

    Gets the ChartComponent that is the subject of the transition.

    ###### Returns

    the chart

  - ### setChart

    public void setChart(ChartComponent chart)

    Sets the ChartComponent that is the subject of the transition.

    ###### Parameters

    - `chart`: the chart to set

  - ### getDuration

    public int getDuration()

    Gets the duration of the transition. (in milliseconds)

    ###### Returns

    the duration

  - ### setDuration

    public void setDuration(int duration)

    Sets the duration of the transition in milliseconds.

    ###### Parameters

    - `duration`: the duration to set

  - ### getEasing

    public int getEasing()

    Gets the type of easing used in the transition. Should be one of EASING_LINEAR, EASING_IN, EASING_OUT, or EASING_IN_OUT.

    ###### Returns

    the easing

  - ### setEasing

    public void setEasing(int easing)

    Sets the type of easing used in the transition. Should be one of EASING_LINEAR, EASING_IN, EASING_OUT, or EASING_IN_OUT.

    ###### Parameters

    - `easing`: the easing to set

  - ### animateChart

    public void animateChart()
    Applies all pending changes to the chart model and renderer using the current animation settings.

  - ### updateChart

    public void updateChart()
    Applies all pending changes to the chart model and renderer and repaints the chart. This is basically like calling animateChart() with a duration of 0.