Page 1 of 1

How do I Reinitialize TLineSeries

Posted: Tue Nov 28, 2006 5:02 am
by 9241637
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

Posted: Tue Nov 28, 2006 7:04 am
by Marjan
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;

Posted: Tue Nov 28, 2006 1:12 pm
by 9241637
Perfect...Thanks a million!