Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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();
}