adding series to average function during runtime

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

adding series to average function during runtime

Post by Steffen » Wed Mar 30, 2011 2:28 pm

I want to add a number of series to the Datasource list of an "average" function.

neither
dbchart1.Series.DataSources := (Query1, Query2, Query 3)
nor
dbchart1.Series.DataSources.List := (Query1, Query2, Query3 )
works. I get the "a read only property can not be assigned a value" error

What is wrong?

Thxs for help,
Steffen

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

Re: adding series to average function during runtime

Post by Yeray » Thu Mar 31, 2011 1:14 pm

Hello Steffen,

You should use the Add function as follows:

Code: Select all

uses TeeFunci, Series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
    line: TFastLineSeries;
    average: TAverageTeeFunction;
begin
  Chart1.View3D:=false;

  for i:=0 to 5 do
  begin
    Chart1.AddSeries(TPointSeries).FillSampleValues();
  end;

  line:=Chart1.AddSeries(TFastLineSeries) as TFastLineSeries;
  average:=TAverageTeeFunction.Create(self);
  line.FunctionType:=average;

  for i:=0 to Chart1.SeriesCount-2 do
    line.DataSources.Add(Chart1[i]);
end;
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

Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

Re: adding series to average function during runtime

Post by Steffen » Thu Mar 31, 2011 2:44 pm

Hi Yeray,

works GREAT - thank you :D

Brgds.
Steffen

Post Reply