Question MSChart and datagridviews / datatables

JBudd

New member
Joined
Sep 13, 2012
Messages
4
Programming Experience
Beginner
Hi all,

Looking for some advice / help please.

I have been asked to add a graph/chart to an existing app that was developed by someone who has since left the company. The app works as follows :-

Data is fed into a DataTable which is then used to populate a DataGridView. There are three coumns that are displayed to the user :-
- Digit
- Count
- Expected_Count

I have been asked to display the results in a bar chart format, and have to use the MSChart addin that MS provide for free due to budgetary constraints.

I am unable to "link" the data to the chart though & am hoping someone can point me in the right direction. I have tried the following without success :-
Code:
chart1.DataSource = AnalysisGrid;
chart1.Series["series1"].XValueMember = "Digit";
chart1.Series["series1"].YValueMembers = "Count";
chart1.DataBind();
Code:
chart1.Series[0].Points.DataBindY((DataView)AnalysisGrid.DataSource, "Count");
Code:
DataView dv = new DataView(ds.Tables["dGridView1"]);
chart1.Series["Series1"].Points.DataBindXY(dv, "Digit", dv, "Count");
chart1.Series["Series2"].Points.DataBindXY(dv, "Digit", dv, "ExpectedCount");
If I try & "link" the graph to the DataTable / DataGridView via the properties screen I am not able to see any of the tables or views.

Any ideas / pointers ?

Thanks

J
 
Top Bottom