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.
Hello,
You would not be able to affect the from/to properties of the Double Animation. What you can set in these animations are the begin time, duration, acceleration ration, deceleration ratio properties. The rest is handled by the XamWebChart. You can see more information on Animations in the XamWebChart in this help article here :
http://help.infragistics.com/NetAdvantage/DV/2009.2/CLR3.5/?page=SL_DV_xamWebChart_Animation_Overview.html
Hi Alex,
Its true, that I can not set 'To', if I'm using a Infragistics Animation. But I'm trying to use the Silverlight DoubleAnimation, not the Infragistics Animation.
So if I can not set 'To', how can I animate the datapoint to change its value to some other?. Say from 10 to 100.
My requirement is to change the values of datapoints at runtime, using animation. Please help.
Also, for your information, I can able to change the datapoint value, using 'To' in DoubleAnimation, if its applied on single datapoint. Only when I tried that in a loop, I'm getting the error shown in previous post.