Skip to main content

How to: Implement a Custom Bar Animation

  • 3 minutes to read

To implement a custom bar animation, design a class inheriting the BarAnimationBase class and override the BarAnimationBase.ApplyState method which determines the transformations applied to an individual bar.

protected override void OnLoad(EventArgs e) {
    base.OnLoad(e);

    chartControl.AnimationStartMode = ChartAnimationMode.OnLoad;
    view.Animation = new ZoomInFromCenterBarAnimation {
        BeginTime = new TimeSpan(0, 0, 0),
        Duration = new TimeSpan(0, 0, 2),
        PointDelay = new TimeSpan(0, 0, 0, 0, 250),
        PointOrder = PointAnimationOrder.Random,
        EasingFunction = new SineEasingFunction {
            EasingMode = EasingMode.Out
        }
    };
}

private void OnAnimateClick(object sender, EventArgs e) {
    chartControl.Animate();
}