ColorGridSeries AddArray

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
kev
Newbie
Newbie
Posts: 42
Joined: Tue Apr 06, 2004 4:00 am
Location: Texas

ColorGridSeries AddArray

Post by kev » Wed Oct 28, 2009 5:02 pm

I need to stuff into a ColorGridSeries using the AddArray method, but cannot figure out how to get it to work. I cannot find a Borland C++ Builder example that shows this and have not been able to find anything in the TChart help. I am using AddArray on several other charts with LineSeries and they work perfectly.

I would prefer to use a standard array as I did on the others instead of using the TArrayGrid which I have never used and which appears to be missing from the Borland Help.

thanks, Kev

I have tries many different variations of the following...

double *arr;
arr=new double[1024*49];

TArrayGrid DataBuf;
DataBuf.Length = 49;

for(int n=0;n<DataBuf.Length;n++)
DataBuf[n].Length = 1024;

int row=0, col=0;

for(int x=0;x<49;x++){
for(int z=0;z;1024;z++){
aStr = DataForm->StringGrid1->Cells[col][row]; //[col][row]
row++;
if(row>1023)
row = 0;

y = StrToFloat(aStr);

if(y < 0)
y = 0;
DataBuf[x][y] = y;

////// OR This ////////

int i = (x * 1024) + z;
arr = y;

//Series1->AddXYZ(x,y,z); //this worked, but was very slow.
}

Series1->AddArray(arr,1024*49); //tried this
Series1->AddArray(DataBuf); //and this. Both seemed to lockup after executing the statement.

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

Re: ColorGridSeries AddArray

Post by Narcís » Mon Nov 02, 2009 12:44 pm

Hi Kev,

First of all, notice that TColorGridSeries needs to have a data structure as I described here. Having said that, there's no array addition method that supports X, Y and Z coordinates. So I think the best option here is adding the arrays directly to series' valuelists as in the Real-time Charting article here. This is the quickest option too :wink:
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