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
How do I Reinitialize TLineSeries
Hi.
If you simply want to remove/free all series in the Form::OnClose event, then all you must do is cal the
To remove&free specific series you can use:
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);
Code: Select all
tmp := tChart.Series[0];
tmp.ParentChart := nil;
tmp.Free;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com