Nice Moving Average Curve

TeeChart for ActiveX, COM and ASP
Post Reply
Guilz
Newbie
Newbie
Posts: 46
Joined: Mon Nov 13, 2006 12:00 am

Nice Moving Average Curve

Post by Guilz » Thu Oct 14, 2010 2:49 pm

Hi,

I use some Teechart function based on main serie (like Moving Average). I use the anti-aliasing tools to render.
But the result on moving average is not so good, the result is not a nice curve...How can I obtain a nice moving average curve ? I hope my sample is more clear than my words :D
smooth.jpg
smooth.jpg (108.65 KiB) Viewed 7095 times
Thanks for your help,

Guilz

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Nice Moving Average Curve

Post by Narcís » Fri Oct 15, 2010 8:47 am

Hi Guilz,

You can add a smoothing function to your chart having the moving average series as source series and make it invisible.

Hope this helps.
Best Regards,
Narcís Calvet / 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

Guilz
Newbie
Newbie
Posts: 46
Joined: Mon Nov 13, 2006 12:00 am

Re: Nice Moving Average Curve

Post by Guilz » Fri Oct 15, 2010 9:18 am

Hi Narcis,

I try what you suggest but the result is not fantastic (not a lot difference between smooth serie based on moving average serie and the moving average serie)
changing factor of smooth serie as not a big impact...
smooth2.jpg
smooth2.jpg (104.55 KiB) Viewed 7159 times
Guilz

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Nice Moving Average Curve

Post by Yeray » Fri Oct 15, 2010 3:19 pm

Hi Guilz,

Take a look at the following example. There is a Point series (source), a moving average function and a smoothing function.
If you zoom in, you'll see how the smoothed function is smoother than the moving average function.

Code: Select all

Private Sub Form_Load()
  TeeCommander1.ChartLink = TChart1.ChartLink
   
  TChart1.Legend.Visible = False
  TChart1.Aspect.View3D = False

  TChart1.AddSeries scPoint
  TChart1.Series(0).FillSampleValues 100
  TChart1.Series(0).asPoint.Pointer.HorizontalSize = 2
  TChart1.Series(0).asPoint.Pointer.VerticalSize = 2
  
  TChart1.AddSeries scLine
  TChart1.Series(1).SetFunction tfMovavg
  TChart1.Series(1).DataSource = TChart1.Series(0)
  TChart1.Series(1).FunctionType.Period = 5
  'TChart1.Series(1).Active = False
  
  TChart1.AddSeries scLine
  TChart1.Series(2).asLine.LinePen.Width = 2
  TChart1.Series(2).SetFunction tfSmoothing
  TChart1.Series(2).DataSource = TChart1.Series(1)
  TChart1.Series(2).FunctionType.Period = 5
End Sub
If you still have problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply