Runtime TFastlineSeries creation

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
PoLabs
Newbie
Newbie
Posts: 28
Joined: Wed Jun 06, 2007 12:00 am

Runtime TFastlineSeries creation

Post by PoLabs » 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

johnnix
Advanced
Posts: 192
Joined: Tue Jul 10, 2007 12:00 am

Post by johnnix » Thu Nov 01, 2007 2:30 pm

Hello,

Try this:

Chart1.AddSeries(Series);

Regards

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Post by xxxxxx » Thu Nov 01, 2007 7:52 pm

10046032 wrote: Chart1.AddSeries(Series);
either

Code: Select all

Series.ParentChart:=Chart1
but also you need

Code: Select all

Series:= TFastLineSeries.Create(Self); 
as Form is an owner of the component Series
Regards, Alexander
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 02, 2007 9:25 am

Hi BR,

Have other users suggestions helped?

Also notice that if you are planning to draw circles you may be interested in using bubble series where you can specify each bubble center (X,Y) and radius. You could set bubble series brush to bsClear if you only want the pen being drawn, for example:

Code: Select all

  Series1.Brush.Style:=bsClear;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

PoLabs
Newbie
Newbie
Posts: 28
Joined: Wed Jun 06, 2007 12:00 am

Working!

Post by PoLabs » Mon Nov 05, 2007 10:12 pm

Thank you guys you realy helped me a lot.

There are so many properties for TChart that I lost myself within it.

About drawing the circles... that was only an example to show you what I mean (easier to describe problem).

Thank you again.

BR
Aljosa

PoLabs
Newbie
Newbie
Posts: 28
Joined: Wed Jun 06, 2007 12:00 am

How to assign Series to axis

Post by PoLabs » Wed Nov 07, 2007 6:34 pm

With your answer you helped me a lot. But I have one more question to ask you.

I have three axes. Left, right and bottom... At first when I create those TFastLineSeries and add it to TChart they are assigned to LeftAxis and Bottom Axis...

How can I switch between combinations of LeftAxis&BottomAxis or RightAxis&BottomAxis?

So I want to assign series sometimes to left axis and sometimes to right axis (bottom is always present)... How can I do that?

Thanks in advance!

BR
Aljosa

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Nov 08, 2007 10:30 am

Hi Aljosa,

You'll find information on that at Tutorial 6 - Working with Series, specially at the Choose Axes for a Series section. You'll find the tutorials at TeeChart's program group.

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply