The Line.Smoothed property

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Snarkle
Newbie
Newbie
Posts: 91
Joined: Wed Jun 30, 2010 12:00 am

The Line.Smoothed property

Post by Snarkle » Thu Jul 08, 2010 8:04 am

In the below code I see a strange occurance ..

Code: Select all

            int x = StockChart.Series.Count;
            
            Line SMALine = new Line(StockChart.Chart);
            MovingAverage SMAFunc = new MovingAverage();

            SMALine.Function = SMAFunc;
            SMALine.DataSource = StockChart.Series[ParentSeries];
            SMALine.Function.Period = 4;
            SMALine.Function.PeriodStyle = PeriodStyles.NumPoints;
            SMALine.Smoothed = true;

            x = StockChart.Series.Count;
I expected to have 1 extra series than I started with .. but when I set Smoothed to true I get another series ... does setting smoothed to true create another series as the result?
If so can I somehow delete the 'orignal' series so that I can get my series indexs back into sync with another part of the code that tracks each series ?

You see by the time I get to this code snippet ... I expected to have a series index = 0 (Candle Series) .. then Apply a simple Moving average and have 2 series .. alas I have 3 ... does this mean if I make a checkbox to switch smoothing on and off at runtime I will be dynamically changing the number of series in the collection. If I set smoothing does it add the "smoothed" series to end of the collection or does it insert the new "smoothed" series directly after the 'parent' series and thus I can never know the index of a series ?

regards Phil.
--------------------
Cheers Phil.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: The Line.Smoothed property

Post by Sandra » Fri Jul 09, 2010 10:35 am

Hello Phil,
I expected to have 1 extra series than I started with but when I set Smoothed to true I get another series ... does setting smoothed to true create another series as the result?
Yes, you've understood correctly it. Internally Smoothed property create a new series, for apply smooth function, when property Smoothed is true. So the result is new internal series, result of combine line series and function smooth.
If so can I somehow delete the 'orignal' series so that I can get my series indexs back into sync with another part of the code that tracks each series ?
You see by the time I get to this code snippet ... I expected to have a series index = 0 (Candle Series) then Apply a simple Moving average and have 2 series .. alas I have 3 ... does this mean if I make a checkbox to switch smoothing on and off at runtime I will be dynamically changing the number of series in the collection. If I set smoothing does it add the "smoothed" series to end of the collection or does it insert the new "smoothed" series directly after the 'parent' series and thus I can never know the index of a series ?
I think that is not necessary to delete original series because property Smoothed changes IndexOf of series and should not affect the code that you make. If you want know exactly that do it property internally, using reflector.

On the other hand, if it causes for you problems in some parts of code. You could indicate exactly which parts and attach a simple example, because we can help you solve it.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply