Jump to content
Software FX Community
rajui

Dynamically adding a series to chart

Recommended Posts

 Am having a series on Line graph

want to add another series to a graph when the user selects a checkbox which i have provided  above the graph

when the user selects the check box i fetched a dataset from DB which contains datapoints.

with this dataset i want to crate an other series on the graph

Share this post


Link to post
Share on other sites

Hi,

To add a series dynamically you first need to increase the number of series:

chart.Data.Series++;

The Series Attributes collection is automatically synchronized with the number of series in the data.

Then you will have to add the items in the collection:

Example:

for (int i = 0; i < chart1.Data.Points; i++)

 {

  chart1.Data[newSeries, i] = ran.NextDouble() * 100;

}

Hope this helps.

Regards,

Share this post


Link to post
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.

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

Loading...

×
×
  • Create New...