Jump to content
Software FX Community

Clearing charts question


Recommended Posts

Using a chart that the user can manually refresh (pulling new SQL data), I'd like to chart to be cleared (reset) before the updated chart data is displayed.  I've tried including as the first item after the 'refresh' button is pushed:


This, however still results in the follow up queries being stacked into the same chart, without the old chart data clearing.

Thanks for any help!

Link to comment
Share on other sites

After the initial query, the chart looks good with two data lines shown.

After the second query, which should clear the data from the initial chart with, 'chart1.Data.Clear();' a second set of lines are drawn (in 3-D) behind the first set, and two additional entries are added to the legend box. 


Link to comment
Share on other sites


Clears the data completely, I think what you may be experiencing is that the second time you are binding the data to the chart not clearing the Fields collection and therefore ending up with duplicate fields. It is only at the time of binding to the new data that the duplicate series are created, not that they remained there from before.

Make sure that if you are adding fields to the Fields collection (chart.DataSourceSettings.Fields) you are clearing it first, otherwise, like any other collection it will ad to the existing items.


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