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

ChartAnimationCollection Class

Represents a collection of all animations in a particular animation record.

Namespace: DevExpress.Xpf.Charts

Assembly: DevExpress.Xpf.Charts.v24.2.dll

NuGet Package: DevExpress.Wpf.Charts

#Declaration

public class ChartAnimationCollection :
    ChartElementCollection<ChartAnimation>

The following members return ChartAnimationCollection objects:

#Remarks

Each animation record (a ChartAnimationRecord class instance) holds a collection of animations, accessed via the ChartAnimationRecord.Animations property and is represented by the ChartAnimationCollection class. The properties and methods exposed by the ChartAnimationCollection class can be used to perform common collection operations, such as adding new or deleting existing items. Each collection item is represented by a ChartAnimation class descendant. Individual animations can be accessed, either using indexer notation or by their names, using specific methods of the collection.

#Example

The following example demonstrates how to animate series points, so that their values are dynamically changed when displaying a chart.

To accomplish this, it is first necessary to add a trigger to a chart’s Triggers collection, which will start the Year1998Animation in response to the chart’s Loaded event. Then, to the ChartControl.AnimationRecords collection, add a ChartAnimationRecord with a SeriesAnimation object.

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" 
        x:Class="WpfApplication1.Window1" Height="500" Width="650">
    <Grid>
        <dxc:ChartControl x:Name="chart">
            <dxc:ChartControl.Diagram>
                <dxc:XYDiagram3D>
                    <!--region #series-->
                    <dxc:XYDiagram3D.Series>
                        <dxc:BarSeries3D x:Name="Year1998" >
                            <dxc:Series.Points>
                                <dxc:SeriesPoint Argument="Illinois" Value="423.72" />
                                <dxc:SeriesPoint Argument="Indiana" Value="178.71" />
                                <dxc:SeriesPoint Argument="Michigan" Value="308.84" />
                                <dxc:SeriesPoint Argument="Ohio" Value="348.54" />
                                <dxc:SeriesPoint Argument="Wisconsin" Value="160.27" />
                            </dxc:Series.Points>
                            <dxc:BarSeries3D.Label>
                                <dxc:SeriesLabel Visible="False"/>
                            </dxc:BarSeries3D.Label>
                        </dxc:BarSeries3D>
                        <!--endregion #series-->
                    </dxc:XYDiagram3D.Series>
                </dxc:XYDiagram3D>
            </dxc:ChartControl.Diagram>
            <!--region #records-->
            <dxc:ChartControl.AnimationRecords>
                <dxc:ChartAnimationRecord x:Name="Year1998Animation" Progress="0">
                    <dxc:ChartAnimationRecord.Animations>
                        <dxc:SeriesAnimation TargetSeries="{Binding ElementName=Year1998}">
                            <dxc:SeriesAnimation.Actions>
                                <dxc:SeriesSeriesPointsAction EqualSpeed="True" 
                                                              Sequential="True" 
                                                              DelayPercentage="30"/>
                            </dxc:SeriesAnimation.Actions>
                        </dxc:SeriesAnimation>
                    </dxc:ChartAnimationRecord.Animations>
                </dxc:ChartAnimationRecord>
            </dxc:ChartControl.AnimationRecords>
            <!--endregion #records-->
            <!--region #triggers-->
            <dxc:ChartControl.Triggers>
                <EventTrigger RoutedEvent="dxc:ChartControl.Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation From="0" To="1" Duration="0:0:3"
                                    Storyboard.TargetName="Year1998Animation" 
                                    Storyboard.TargetProperty="Progress" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </dxc:ChartControl.Triggers>
            <!--endregion #triggers-->
        </dxc:ChartControl>
    </Grid>
</Window>
See Also