Moving Average functions

TeeChart for ActiveX, COM and ASP
Post Reply
hansw
Newbie
Newbie
Posts: 59
Joined: Fri Nov 15, 2002 12:00 am

Moving Average functions

Post by hansw » Tue Dec 09, 2003 7:05 pm

Just how is the Moving average function used ?
Is there an example ?

I have a chart type scLine
m_Chart1.AddSeries(scLine);

m_Chart1.Series(0) ??? what next ?

Can moving average functions be used with scLine type charts ?

I'm still interested to know how moving average function are used...


Thanks
Hans W

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Dec 10, 2003 11:51 am

Here one example :

>Is there an example ?

Code: Select all

  m_chart.GetAspect().SetView3D(false);
  m_chart.AddSeries(scLine);
  m_chart.Series(0).FillSampleValues(20);
  m_chart.AddSeries(scLine);
  m_chart.Series(1).SetFunction(tfMovavg);
  m_chart.Series(1).GetFunctionType().SetPeriod(3);
  m_chart.Series(1).SetDataSource(COleVariant("Series0"));
>Can moving average functions be used with scLine type charts ?
Yes, see the above example ..

Josep Lluis Jorge
http://support.steema.com

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Dec 10, 2003 11:52 am

Also, forget to tell you that you can find more info about the Function types and how to use them in the TeeChart Pro Tutorials ( 7- Working with Functions) .

Josep Lluis Jorge
http://support.steema.com

hansw
Newbie
Newbie
Posts: 59
Joined: Fri Nov 15, 2002 12:00 am

allergic reaction

Post by hansw » Wed Dec 10, 2003 2:51 pm

Josep,
Thanks... But that part of the Tutorial is in VB and you know I have a serious allergic reaction to VB :-)

I'm slowly building my How to Survuve TeeChart for VC++ users...
I'll add this example to that page...

Hans W

hansw
Newbie
Newbie
Posts: 59
Joined: Fri Nov 15, 2002 12:00 am

How to use it ?

Post by hansw » Thu Dec 18, 2003 12:37 am

m_Chart1.Series(0).SetFunction(tfMovavg);
m_Chart1.Series(0).GetFunctionType().SetPeriod(4.0);
m_Chart1.Series(0).SetDataSource(COleVariant("YValues"));

OK that compiles.

How is it used ?

Once every second this is called to update the chart, but where/when is the
moving average implemented ?

m_Chart1.Series(0).AddArray( 4096, YValues, XValues); // update

Everything I've tried to date and no moving average !

The help files(tutorial) imply it all just happens ! But it does not...

Post Reply