Page 1 of 1

Moving Average functions

Posted: Tue Dec 09, 2003 7:05 pm
by 9078641
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

Posted: Wed Dec 10, 2003 11:51 am
by Pep
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

Posted: Wed Dec 10, 2003 11:52 am
by Pep
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

allergic reaction

Posted: Wed Dec 10, 2003 2:51 pm
by 9078641
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

How to use it ?

Posted: Thu Dec 18, 2003 12:37 am
by 9078641
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...