Jump to content
Software FX Community

Cannot bind datatable to chart


Recommended Posts


Hello all,

this is a very newbie question but with the help document i cannot bind a datatable to the chart.

Basicallyi am not getting the datatable from a database, im creating a datablewith dynamic data that the user types in the application.

The thing is when i bind the datable to the chart, doesnt display the value.

DataTable t = new DataTable();t.Columns.Add("Name");t.Columns.Add("Age");DataRow dr = t.NewRow();dr[0] = "Duncan";dr[1] = 25;t.Rows.Add(dr);mFarmLoadChart.DataSource = t;

Doi need to set some basic stuff to the chart like series and such? Sorryto bother you with such a trivial thing but reading the documentation icouldnt find out what are the most basic settings i must set for thechart to load a datatable.
Link to comment
Share on other sites

 try this (replace your datasource):

mFarmLoadChart.DataSourceSettings.Fields.Add(new FieldMap("Age", FieldUsage.Value)); // Set the Y axis valuesmFarmLoadChart.DataSourceSettings.Fields.Add(new FieldMap("Name", FieldUsage.Label)); // Set the X axis valuesmFarmLoadChart.DataSourceSettings.DataSource = t;

All written in the documentation/examples


Raydenxxx (France)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...