1 Replies - 1209 Views - Last Post: 27 November 2012 - 02:58 PM Rate Topic: -----

#1 JBudd  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 13-September 12

MSChart and DataGridView / dataTable

Posted 27 November 2012 - 01:46 PM

Hi all,

Looking for some advice / help please.

I have been asked to add a graph/chart to an existing app. 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 :-

chart1.DataSource = AnalysisGrid;
chart1.Series["series1"].XValueMember = "Digit";
chart1.Series["series1"].YValueMembers = "Count";
chart1.DataBind();



chart1.Series[0].Points.DataBindY((DataView)AnalysisGrid.DataSource, "Count");



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

Is This A Good Question/Topic? 0
  • +

Replies To: MSChart and DataGridView / dataTable

#2 AthenaDX  Icon User is offline

  • D.I.C Regular

Reputation: 101
  • View blog
  • Posts: 307
  • Joined: 26-October 12

Re: MSChart and DataGridView / dataTable

Posted 27 November 2012 - 02:58 PM

Nevermind, did not include what you needed. The information I've come across on other sites show you're doing the databind correctly.

Don't know much about this but since I can't very well delete this post, I'll attempt?

You're doing DataBindXY, shouldn't it be DataBindX on one and DataBindY on the other?

/wishes her post could be deleted.

This post has been edited by AthenaDX: 27 November 2012 - 03:07 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1