Skip to main content

ChartAnimationRecordCollection Class

Represents a collection of all animation records in a chart.

Namespace: DevExpress.Xpf.Charts

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

NuGet Package: DevExpress.Wpf.Charts

Declaration

public class ChartAnimationRecordCollection :
    ChartElementCollection<ChartAnimationRecord>

The following members return ChartAnimationRecordCollection objects:

Remarks

The ChartAnimationRecordCollection class represents a collection of ChartAnimationRecord objects that represent animation records. Its properties and methods can be used to perform common collection operations such as adding new or deleting existing items. Individual items can be accessed using indexer notation.

A collection of animation records can be accessed via the chart control’s ChartControl.AnimationRecords property.

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