Jump to content
Software FX Community

Assigning DataSet to Chartfx object


Recommended Posts

In asp.net in VS2005 for webform, I have a DataSet which has the resultset from a table.

And I am assigning it to Chart object as follows,

Chart1.DataSource = ds.tables[0];


But instead of assigning a full table to Chart object, I need to assign a certain columns alone to it. Is that possible?

Like will this work as given below...

Chart1.DataSource = ds.tables[0].Columns[4];

Chart1.DataSource = ds.tables[0].Columns[5];


Thanks in advance.

Link to comment
Share on other sites

Hi gopikrish

You can try adding some FieldMap object to the DataSourceSettings.  Those objects allows you to configure how Chart FX will store the data provided by the DataProvider.  Please check the following code:

chart1.DataSourceSettings.Fields.Add(new FieldMap("Date",FieldUsage.XValue));   chart1.DataSourceSettings.Fields.Add(new FieldMap("High",FieldUsage.Value));   chart1.DataSourceSettings.Fields.Add(new FieldMap("Low",FieldUsage.Value));   chart1.DataSourceSettings.Fields.Add(new FieldMap("Closed",FieldUsage.Value));   chart1.DataSource = ds.Tables[0]; 

More information in Chart FX Samples & Resource Center >>> API Reference >>> Chart FX WebForms >>> DataSourceSetttings Class >>> Properties >>> Fields.

Carlos Chaves


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...