Page 1 of 1

ColorGridSeries AddArray

Posted: Wed Oct 28, 2009 5:02 pm
by 9232023
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.

Re: ColorGridSeries AddArray

Posted: Mon Nov 02, 2009 12:44 pm
by narcis
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: