How do I Reinitialize TLineSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
CAC
Newbie
Newbie
Posts: 44
Joined: Tue Jun 20, 2006 12:00 am
Location: Plain City, Ohio
Contact:

How do I Reinitialize TLineSeries

Post by CAC » Tue Nov 28, 2006 5:02 am

I have a chart whose series are created at the OnShow event for my form. I have a while loop that moves through a query to establish multiple series. Everything works great until I close the form and open it again, then I end up with twice as many series.

How do I reinitialize the series so I do not get duplicates, triplicates, etc.
I have tried MySeries.Free at the OnShow event, but that didn't seem to help. Should I make the variable MySeries a global variable and then use the MySeries.Free at the OnClose event?

Thanks

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

Post by Marjan » Tue Nov 28, 2006 7:04 am

Hi.

If you simply want to remove/free all series in the Form::OnClose event, then all you must do is cal the

Code: Select all

tChart.FreeAllSeries(nil); 
To remove&free specific series you can use:

Code: Select all

tmp := tChart.Series[0];
tmp.ParentChart := nil;
tmp.Free;
Marjan Slatinek,
http://www.steema.com

CAC
Newbie
Newbie
Posts: 44
Joined: Tue Jun 20, 2006 12:00 am
Location: Plain City, Ohio
Contact:

Post by CAC » Tue Nov 28, 2006 1:12 pm

Perfect...Thanks a million!

Post Reply