Xamarin.Android | ComponentOne
Controls / FlexChart / Features / Animation
In This Topic
    Animation
    In This Topic

    FlexChart allows you to enable animation effects using one of the two ways, either on loading when the chart is drawn or on updating when the chart is redrawn after modifications. It supports animation in charts through C1Animation class available in the C1.Android.Core namespace.

    You can also set the duration of animation in chart using Duration property of the C1Animation class and interpolate the values of animation using Easing property of the C1Animation class, which accepts values from the C1Easing class. This class supports a collection of standard easing functions such as CircleIn, CircleOut, and Linear.

    C#
    Copy Code
    C1Animation animate = new C1Animation();
    // set update animation duration
    animate.Duration = new TimeSpan(3000 * 10000);
    // interpolate the values of animation
    animate.Easing = C1Easing.Linear;

    In addition to easing functions of C1Easing class, FlexChart supports built in easing functions of Xamarin.Forms.Easing class. For more information, refer Xamarin Easing Class.

    You can show animation while loading or updating a chart. To show animation while loading, use LoadAnimation property of the ChartBase class. This property gets the load animation from the object of C1Animation class to display the animation at the time of loading chart. Similarly, to animate the chart when underlying data collection changes on adding, removing, or modifying a value, you can use UpdateAnimation property of the ChartBase class.

    C#
    Copy Code
    // set the loading animation
    flexchart.LoadAnimation = animate;

    You can apply loading animation effect by setting AnimationMode property which accepts values from AnimationMode enumeration. This enumeration supports four different animation modes: All, None, Series, and Point.

    C#
    Copy Code
    // set the animation mode
    flexchart.AnimationMode = AnimationMode.Series;