views:

1305

answers:

3

Hello! I am using the Dundas Chart Controls/Microsoft Chart Control for .Net. Currently I have a method which populates the chart control with date from a generic List.

Lets say for example that I populate the chart with data from one list. Then I want to populate the chart with data from another list.

The problem I have is that when populating the chart with the data from the second list, I end up with a chart that displays the combined data from list 1 and list 2, whereas I want it to display only the data from the first list, and then clear the chart before displaying the data from the second list.

I have tried various method calls to clear the chart control before populating it with the data from the second list but to no avail.

Does anyone know of a way of doing this? Help appreciated greatly,

Regards,

A: 

You should probably post some example code.

However, I would guess it is simply a matter of resetting the data source. Assuming you have a list of points (or some other structure), you should probably create a new instance of that data container (i.e. the list), populate that, and then assign it to the chart.

Instead, it seems like you are probably trying to set the elements of an existing data container and not clearing it out correctly.

casperOne
+1  A: 

Found it!

chart1.Series[0].Points.Clear();

Goober
A: 

A comment for others who may come across this:

To clear out the chart series, titles, and legends:

//clear chart
Chart1.Series.Clear();
Chart1.Titles.Clear();
Chart1.Legends.Clear();           
//create chart
John M