Page 1 of 1

chart autorepaint or series autorepaint

Posted: Mon Dec 28, 2009 5:09 am
by 9529132
As suggested by many posts, it is better to set autorepaint false to speed up plotting great number of data, but when I search the help file, both chart and series have autorepaint property. So which one should I set or should I set both.

And how to disable locking for single thread using C++?

Re: chart autorepaint or series autorepaint

Posted: Mon Dec 28, 2009 11:24 am
by yeray
Hi David,

FastLineSeries' autorepaint property prevents the whole chart to be repainted every time the series is updated or a vale is added to it.
Chart's autorepaint property prevents the chart to be repainted at all.

Regarding the threading, here is an explanation about TeeChart limitations.

Re: chart autorepaint or series autorepaint

Posted: Mon Dec 28, 2009 1:26 pm
by 9529132
My question was not answered yet. I know there is autorepaint property for both fastline and chart. My question is which one I should use or should I set both? As in the following code, are the two for loops able to make the plotting even faster? With the chart autorepaint disabled, does it matter to disable/enable series autorepaint?

Code: Select all

m_chart1.SetAutoRepaint(FALSE);
for(int i=0;i<3;i++)
     m_chart1.Series(i).GetAsFastLine().SetAutoRepaint(FALSE);

//code to update series(0) to series(3)

for(int i=0;i<3;i++)
     m_chart1.Series(i).GetAsFastLine().SetAutoRepaint(TRUE);

m_chart1.SetAutoRepaint(TRUE);
m_chart1.Repaint();
As for disable locking, in the real-time chart article, it is Basic code as

Code: Select all

  // When using only a single thread, disable locking:
  Chart1.Canvas.ReferenceCanvas.Pen.OwnerCriticalSection := nil;
  Series1.LinePen.OwnerCriticalSection := nil;
So my another question is how to realize it in C++?

Re: chart autorepaint or series autorepaint

Posted: Wed Dec 30, 2009 10:34 am
by yeray
Hi David,

I recommend you to use series' autorepaint instead of chart's autorepaint. Then, if you need even more optimization, you could try chart's autorepaint instead of series' autorepaint but series drawing is the process that takes more time (incremented with the number of points to show). But, as you suspected, setting chart's autorepaint to false, series' autorepaint to false will be redundant.

Regarding the real-time article, I'm afraid it's not possible to lock TeeChart's pen in ActiveX.

Re: chart autorepaint or series autorepaint

Posted: Wed Dec 30, 2009 11:10 am
by 9529132
I am a little bit confused. If series drawing is the process that takes more time, it seems logic to use series' autopaint, but then you said to get more optimization, I should use chart's autopaint. So exactly which way is faster, using series' autopaint or using chart's autopaint?

Re: chart autorepaint or series autorepaint

Posted: Wed Dec 30, 2009 12:15 pm
by yeray
Hi David,

Series autorepaint to false forces the series to not be redrawn.
Chart autorepaint to false forces the series to not be redrawn but also axes, titles,...

Re: chart autorepaint or series autorepaint

Posted: Thu Dec 31, 2009 12:57 am
by 9529132
OK, got it. Thank goodness it is solved before 2010. :D Happy new year to you!

Re: chart autorepaint or series autorepaint

Posted: Thu Dec 31, 2009 8:25 am
by yeray
Hi David,

The same to you! :D