views:

431

answers:

1

I have an xml file:

<Database>
<Stat>
<Date>06/07/2009 00:00:00</Date> 
 <DayOfWeek>Monday</DayOfWeek> 
 <SentNumber>3248</SentNumber> 
 <ReceivedNumber>50</ReceivedNumber> 
 </Stat>
<Stat>
 <Date>07/07/2009 00:00:00</Date> 
 <DayOfWeek>Tuesday</DayOfWeek> 
 <SentNumber>1000</SentNumber> 
 <ReceivedNumber>500</ReceivedNumber> 
 </Stat>
 </Database>

I want to populate a Microsoft Chart Control bar chart in C# with the contents however i'm very confused about how to do this from the available tutorials. Any help would be greatly appreciated!

A: 

Could you provide a link to where you got the Chart Control you're using? I don't see a chart control in my VS 2008 toolbox.

So, I'm not familiar with the chart control you're using, but I have done lots of data binding to DataGridView controls.

If it works the same way, then you should be able to populate an XDocument (via the Load or Parse methods) with your XML data and then use LINQ to query the data you want to display in your chart. Once you have your query, then use the ToList extension method to generate a List that you can assign to the DataSource property of your chart.

Dennis Palmer
http://code.msdn.microsoft.com/mschart -- Download at the bottom of the article, before the comments.
p.campbell
Indeed it is the microsoft chart control. Charts designed by Dundas and bought by Microsoft and released for free........
Goober