Runtime TFastlineSeries creation
Posted: Thu Nov 01, 2007 10:42 am
Hello!
I have some problems with generating Series(TFastlineSeries) with for loop. I would like to create 10 Series (TFastLineSeries) at runtime or on form creation... But then I have problems with displaying all 10 series on Chart.
Now I have code like that:
procedure TForm2.Button1Click(Sender: TObject);
var X,Y:single;
i, j:integer;
Series: TFastLineSeries;
begin
for j:=0 to 9 do
begin
Series:= TFastLineSeries.Create(Chart1);
Series.Name := 'Series'+IntToStr(j);
Series.XValues.Order:=loNone;
Series.YValues.Order:=loNone;
// calc points for circles
for i := 0 to 360 - 1 do
begin
X := (10+j*10) * cos ( i*PI/180 );
Y := (10+j*10) * sin ( i*PI/180 );
Series.AddXY(X,Y,'',clRed);
end;
Chart1.SeriesList.Add(Series);
Chart1.SeriesList.AllActive:=true;
end;
I expect that I would see 10 circles with different radius, but nothing happend to Chart.... I assume that there should be some code to display or refresh these 10 series on chart.
Does anybody know how can I display those 10 series.
Thank you in advance.
BR
I have some problems with generating Series(TFastlineSeries) with for loop. I would like to create 10 Series (TFastLineSeries) at runtime or on form creation... But then I have problems with displaying all 10 series on Chart.
Now I have code like that:
procedure TForm2.Button1Click(Sender: TObject);
var X,Y:single;
i, j:integer;
Series: TFastLineSeries;
begin
for j:=0 to 9 do
begin
Series:= TFastLineSeries.Create(Chart1);
Series.Name := 'Series'+IntToStr(j);
Series.XValues.Order:=loNone;
Series.YValues.Order:=loNone;
// calc points for circles
for i := 0 to 360 - 1 do
begin
X := (10+j*10) * cos ( i*PI/180 );
Y := (10+j*10) * sin ( i*PI/180 );
Series.AddXY(X,Y,'',clRed);
end;
Chart1.SeriesList.Add(Series);
Chart1.SeriesList.AllActive:=true;
end;
I expect that I would see 10 circles with different radius, but nothing happend to Chart.... I assume that there should be some code to display or refresh these 10 series on chart.
Does anybody know how can I display those 10 series.
Thank you in advance.
BR