Page 1 of 1

adding series to average function during runtime

Posted: Wed Mar 30, 2011 2:28 pm
by 10054213
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

Re: adding series to average function during runtime

Posted: Thu Mar 31, 2011 1:14 pm
by yeray
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;

Re: adding series to average function during runtime

Posted: Thu Mar 31, 2011 2:44 pm
by 10054213
Hi Yeray,

works GREAT - thank you :D

Brgds.
Steffen