TTeeFunction.PeriodStyle

TTeeFunction.PeriodStyle
TTeeFunction

property PeriodStyle: TFunctionPeriodStyle;

Unit
TeEngine

Description
Default Value: psNumPoints

The PeriodStyle property controls how the Period property is interpreted. By default is psNumPoints, meaning Period is specified in number of points. psRange means Period property is specified in a range of values.

Being able to define Period as a range can be very useful when using Date-Time series and when you want to express the "Period" of the function in a date-time step like "OneMonth" or "OneDay".

So, for example you can now plot the, for example, "monthly average of sales" function just using a normal "Average" function on a date-time source series and setting the function period to "one month":

{ Place a Series1 and fill it with datetime data values at runtime (or from a database) }

Series2.SetFunction( TAverageTeeFunction.Create ) ;
Series2.FunctionType.PeriodStyle:=psRange;
Series2.FunctionType.Period:=DateTimeStep[ dtOneMonth ];
Series2.DataSource:=Series1 ;

This will result in several points, each one showing the "average" of each month of data in Series1.
It's mandatory that points in the source Series1 should be sorted by date when calculating functions on datetime periods.

The range can also be used for non-datetime series:

Series2.SetFunction( TAverageTeeFunction.Create ) ;
Series2.FunctionType.PeriodStyle:=psRange;
Series2.FunctionType.Period:=100;
Series2.DataSource:=Series1 ;

This will calculate an average for each group of points inside every "100" interval.
(Points with X >=0, X<100 will be used to calculate the first average, points with X >=100, X<200 will be used to calculate the second average and so on... )
Notice this is different than calculating an average for every 100 points.