Page 1 of 1
Dynamic generation of Multiple TLineSeries
Posted: Tue Feb 27, 2007 9:47 pm
by 9233515
Hello!
I want to dynamically generate several TLineSeries at run time, but my code keeps making errors.
TLineSeries *PolygonLSeries[10] = new TLineSeries(NULL);
How can I do this?
Thank you in advance.
Posted: Wed Feb 28, 2007 10:31 am
by narcis
Hi IIHR,
You can do something like this:
Code: Select all
int NumSeries = 10;
for (int i=0; i < NumSeries; i++) {
Chart1->AddSeries(new TLineSeries(this));
Chart1->Series[i]->FillSampleValues();
}
An example using arrays would be:
un exemple de array podria ser :
(*.cpp file):
Code: Select all
RandCharts = new TChart *[RandChartCount];
RandSeries = new TLineSeries *[RandChartCount];
for(int i=0;i<RandChartCount;++i)
{
// create charts and series
RandCharts[i] = new TChart(this);
RandSeries[i] = new TLineSeries(this);
RandCharts[i]->Parent = ScrollBox1;
RandCharts[i]->AddSeries(RandSeries[i]);
Charts and series in *.h file defined as follows:
Code: Select all
TChart **RandCharts;
TLineSeries **RandSeries;