Zooming and function

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
TeeChart VCL / CLX for Borland Delphi, C
Newbie
Newbie
Posts: 1
Joined: Fri Nov 15, 2002 12:00 am
Contact:

Zooming and function

Post by TeeChart VCL / CLX for Borland Delphi, C » Wed May 05, 2004 4:38 pm

I use TaverageTeeFunction function. It calculates an average value for all the series. But after zooming the value doesn’t change. Can the function work with zooming?

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Thu May 06, 2004 8:25 pm

Hi.

By default the average function calculates the average of all series points (or groups all series points and calculates the average of each group). In your case the function only has to use range of points to calculate the average.
A way around this is to use the average function Calculate method to calculate range average and then use the code in appropriate chart events to adjust function value:

Code: Select all

procedure ConstructAvg(Source: TChartSeries; first,last: Integer; AvgFun: TAverageTeeFunction);
var avg: double;
begin
  avg := AvgFun.Calculate(Source,first,last);
  with AvgFun.ParentSeries do
  begin
    Clear;
    AddXY(Source.XValues[first],avg);
    AddXY(Source.XValues[last],avg);
  end;
end;

Post Reply