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.
TeeChart Bug
Hi.
Instead of
you could also call the
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.
Instead of
Code: Select all
Series1.ParentChart := nil;
Series2.ParentChart := nil;
Series1.Free;
Series2.Free;
Code: Select all
Chart1.FreeAllSeries();
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
TeeChart Bug
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.
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.