Dynamic generation of Multiple TLineSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
IIHR
Newbie
Newbie
Posts: 10
Joined: Wed Aug 11, 2004 4:00 am
Location: USA
Contact:

Dynamic generation of Multiple TLineSeries

Post by IIHR » Tue Feb 27, 2007 9:47 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Feb 28, 2007 10:31 am

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;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply