DateTime Data Problems in Silverlight and C#

Posted by Zhang JingChu under C# on 7/19/2011 | Points: 10 | Views : 1400 | Status : [Member] | Replies : 1
DateTime Data Problems in Silverlight and C#

I am using VISI Fire in Silverlight and C# to produce some data charts. One style of chart allows stacked data to be displayed in colums the xaml code I am using looks like this

The chart i am trying to build is based on a visi fire chart example. if you go to and look at their stacked examples here you can see the xaml example I am trying to emulate.

But my chart comes out differently. mine has this odd overlaping date feature

Now, I have carefully stepped through the code and as far as I can tell, I have the same date for each data set pair.

for (i = 0; i < Count; i++)

Series[0].DataPoints.ElementAt(i).XValue = new DateTime((Int32) XXX.ElementAt(i).Year_Id,(Int32) XXX.ElementAt(i).Month_Id, (Int32)1);
Series[0].DataPoints.ElementAt(i).YValue = (double)XXX.ElementAt(i).Dataz;

Series[1].DataPoints.ElementAt(i).XValue = new DateTime((Int32)YYY.ElementAt(i).Year_Id, (Int32)YYY.ElementAt(i).Month_Id, (Int32)1);
Series[1].DataPoints.ElementAt(i).YValue = (double)YYY.ElementAt(i).Dataz;



I have stepped through this code and I have made sure that with each value for i, the years and the months for each data pair are exactly the same. So why is my graph so messed up?

Is there something wrong with they way I am using the DateTime class?

new DateTime((Int32) Year_Id,(Int32) SMonth_Id, (Int32)1);


Posted by: Zhang JingChu on: 7/20/2011 [Member] Starter | Points: 25

I got it working.
I needed to add specification to the XAML:


<vc:Axis ValueFormatString="MMM - yyyy" Padding="4" LineThickness="0" IntervalType="Months" Interval="1"/>


Zhang JingChu, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response