Search code examples
c#.netmicrosoft-chart-controlsdundas

Microsoft Chart Controls/Dundas Charts Clear Contents?


I am using the Dundas Chart Controls and Microsoft Chart Controls for .NET. Currently I have a method which populates the chart control with a date from a generic List.

Let's say that I populate the chart with data from one list. Then I want to populate the chart with data from another list.

I have a problem 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.

Is there a way of doing this?


Solution

  • I found it! Do this:

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