TeeChart Bug

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
dmitri
Newbie
Newbie
Posts: 2
Joined: Thu Mar 25, 2004 5:00 am
Location: The Netherlands
Contact:

TeeChart Bug

Post by dmitri » Mon Jun 07, 2004 6:38 am

TeeChart 7.0

Assume Series1 and Series2 programmatically created and added to the Chart component.

Then code:

Chart.RemoveAllSeries;
Series1.Free;
Series2.Free;

Above code can cause exception error.

Series1.ParentChart := nil;
Series2.ParentChart := nil;
Series1.Free;
Series2.Free;

Above code will work properly.

Tracing the source code I figure out that RemoveAllSeries method is not the same as setting nil to ParentChart property for all series in the Chart component (as written in documentation). With RemoveAllSeries method, FMarks.ParentChart member of Series is not set to nil. That cause exception error during freeing Series component.

Suggestions:

Chart.RemoveSeries(Series1)
Series1.ParentChart := nil;

has to be equivalent.
Dmitri Sirobokov
MaxControl BV
maxcontrol@maxcargo.com

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

Post by Marjan » Mon Jun 07, 2004 3:24 pm

Hi.

Instead of

Code: Select all

Series1.ParentChart := nil; 
Series2.ParentChart := nil; 
Series1.Free; 
Series2.Free; 
you could also call the

Code: Select all

Chart1.FreeAllSeries();
which does the same thing, but with single line call. Also, do not use the RemoveSeries or RemoveAllSeries if you're freeing series. The Remove* simply removes series from SeriesList and notifies it's parent about it.
Marjan Slatinek,
http://www.steema.com

dmitri
Newbie
Newbie
Posts: 2
Joined: Thu Mar 25, 2004 5:00 am
Location: The Netherlands
Contact:

TeeChart Bug

Post by dmitri » Mon Jun 07, 2004 3:45 pm

I can not use Chart1.FreeAllSeries.

Series1 and Series2 are global variables in my program and there can be more than one dialog with charts displaying those series (but one dialog at a time).

So I have to destroy those series during program termination.
Dmitri Sirobokov
MaxControl BV
maxcontrol@maxcargo.com

Post Reply