Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1810
Animation on datapoints
posted

I have a XamWebChart with the following series object,

<igChart:XamWebChart.Series>
                <igChart:Series ChartType="Line" Fill="#FF81A938" StrokeThickness="2" Animation="{StaticResource DataPointAnimation}">
                    <igChart:Series.Marker>
                        <igChart:Marker Foreground="#FF666666" MarkerSize=".7" Type="Circle" />
                    </igChart:Series.Marker>
                    <igChart:Series.DataPoints>
                        <igChart:DataPoint x:Name="dp1" Label="2000" Value="686" />
                        <igChart:DataPoint x:Name="dp2"  Label="2001"  Value="641" />
                        <igChart:DataPoint x:Name="dp3"  Label="2002"  Value="620" />
                        <igChart:DataPoint x:Name="dp4"  Label="2003"  Value="592" />
                        <igChart:DataPoint x:Name="dp5"  Label="2004"  Value="570" />                       
                    </igChart:Series.DataPoints>
                </igChart:Series>               
            </igChart:XamWebChart.Series>

 

In the code behind, I'm creating a storyboard like,

 

Storyboard sb = new Storyboard();

foreach (DataPoint dp in ChartPhoneUsage.Series[0].DataPoints)
            {
                DoubleAnimation db = new DoubleAnimation();
                db.To = (i + 1) * 100;
                db.Duration = new TimeSpan(0, 0, 1);

                Storyboard.SetTarget(db, dp);
                Storyboard.SetTargetProperty(db, new PropertyPath(DataPoint.ValueProperty));
                sb.Children.Add(db);
                i++;
            }

            sb.Begin();

When I run, I see the runtime exception AG_E_BAD_PROPERTY. [Refer attachement] I'm seeing it 5 times.

When I remove the loop or modify the loop condition to run the animation on only one datapoint, but not on all the datapoints, then its working.

 

Parents Reply Children
No Data