Remove Series from chart without freeing that same series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
GoToXY
Newbie
Newbie
Posts: 81
Joined: Thu Apr 03, 2008 12:00 am

Remove Series from chart without freeing that same series

Post by GoToXY » Thu Oct 30, 2008 7:17 pm

Hi

I have some objetcs that have Series in it. Because i need to used them on multiple charts. When i delete them from a chart, it free it at the same time but i need to keep it. So how can i bypass that. Maybe im not doing it right to add/delete them so this is my simple code.

Adding

Code: Select all

MyObject.MySerie := TLineSeries.Create(Nil); //Nil as Owner should mean -> i will free it Myself.
//Populate my serie
Chart.AddSeries(MyObject.MySerie);
Deleting

Code: Select all

Chart.SeriesList.Clear;
When i use Clear, it clear all series but free them too.

GoToXY
Newbie
Newbie
Posts: 81
Joined: Thu Apr 03, 2008 12:00 am

Post by GoToXY » Thu Oct 30, 2008 7:43 pm

ok i found why its freeing them.

Have to change ParentChart to Nil so it wont be deleted, btw you should check the owner for freeing them and not the parent. This goes againts the VCL standard.

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 Oct 31, 2008 8:28 am

Hi GoToXY,

To remove chart series without freeing them you can use Chart1.RemoveAllSeries. Anyway, I'll add your suggestion to the list to be investigated for next releases.
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