We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Chart.Series.Clear() function takes forvever

Hi

I have more than two thousand series contained in the Chart.Series collection, when I call Chart.Series.Clear(), it takes forever to clear the list.

I did call Chart.Series.BeginUpdate() before and Chart.Series.EndUpdate() after, but it doesnt help.

Thanks,
Youfei


7 Replies

VK Vijayabharathi K Syncfusion Team May 17, 2011 06:35 AM UTC

Hi Youfei,

Thanks for using Syncfusion products.

The “Series.clear()” method to takes 2 to 3 minutes for clear the more than 2000 series in chart control. If your intention is to clear the series from chart area in a seconds means, we suggest you to use “ResetSeriesModel()” method to reset the chart series model in chart area. Please refer the below code snippet to achieve this,

[C#]

for (int k = this.chartControl1.Series.Count -1; k >= 0; k--)
this.chartControl1.Series[k].ResetSeriesModel();

Please let us know if have any concern.

Regards,
Vijayabharathi





YC Youfei Chen May 17, 2011 08:08 PM UTC

Hi Vijay

Thanks for your quick response. Your method does its job, in terms of cleaning the chart, but my application needs to regularly update the chart, which means I will have to add another several k series to the chart shortly after the chart was cleared. So if I just reset the model instead of clearing the series, syncfusion throws an exception of "System.StackOverflowException" which I believe because your workaround leaves series behind.

Any idea?

Thanks,
Youfei



VK Vijayabharathi K Syncfusion Team May 20, 2011 07:38 AM UTC

Hi Youfei,

Thanks for the update.

The “Series.Clear() function takes time while clear the more than 2000 chart series” issue has been confirmed as a defect.
Could you please open a new incident in Direct-Trac for this issue? so that we could provide you a patch for this issue.

Please let us know if you have any concern.

Regards,
Vijayabharathi





YC Youfei Chen June 1, 2011 08:01 PM UTC

I was on vocation. Just did it.

Thanks,
Youfei



VK Vijayabharathi K Syncfusion Team June 2, 2011 06:40 AM UTC

Hi Youfei

Thanks for the update.

Regards,
Vijayabharathi



SE Seamus February 23, 2015 10:49 PM UTC

Was this ever fixed? I have a chart that has 1000+ series, and to replot it,  I need to call Chart.Series.Clear(), and this takes more than 2minutes.


JA Jayavigneshwaran Syncfusion Team February 24, 2015 12:34 PM UTC

Hi Youfei,

Thanks for using Syncfusion software.

We have analyzed this.

This can be overcome by setting the below options in chart

[CS]

  this.chartControl1.ImprovePerformance = true;

  this.chartControl1.CalcRegions = false;

  this.chartControl1.NeedPerformance = true;

  series1.EnableStyles = false;

We have made a sample to illustrate this. Find it from the below location
Windows_forms.zip

In this sample , we have added 1000 series and each series has 100 points. Then the series.clear() method is calculated.

This works fine and takes few seconds to clear.

Please let us know if you have any concern.

Thanks,

Jayavigneshwaran



Loader.
Live Chat Icon For mobile
Up arrow icon