Page 1 of 1

ColorGridSeries::AddArrayGrid

Posted: Tue Nov 30, 2004 7:07 am
by 9080963
Hi, I have this code:

int i = 0;
int sx, sy;
double * buf = new double[nx*ny];
...
for(int y=0; y<ny; ++y) {
for(int x=0; x<nx; ++x,++i) {
m_SeriesGrid.GetAsColorGrid().AddXYZ( (double)(x+sx), buf, (double)(y+sy), "", my_palette.GetColor( buf ));
}
}

My question: how i can use method AddArrayGrid (or may be AddArrayXYZ) instead of these loops and calling AddXYZ?

Thanks

Posted: Tue Nov 30, 2004 8:28 am
by Pep
Hi,

a simple example coud be something like this (apologies for VB code) :

Code: Select all

Private Sub Form_Load() 
Dim XZArray() As Double 
Dim x As Integer, z As Integer 
With TChart1 
.Legend.Visible = False 
.AddSeries scSurface 
.Axis.Depth.Visible = True 
' initialize dynamic array grid 
ReDim XZArray(35) 
' fill with random values 
For x = 0 To 4 
For z = 0 To 6 
XZArray(x * 7 + z) = Rnd 
Next z 
Next x 
' add to 3D series: 
.Series(0).asSurface.AddArrayGrid 5, 7, XZArray 
.Axis.Bottom.SetMinMax 1, 4 
.Axis.Depth.SetMinMax 2, 4 
End With 
End Sub 

Posted: Tue Nov 30, 2004 3:54 pm
by 9080963
I use ActiveX version of TChart from MS Visual C++ (MFC) application and method for adding values from array is declared as:

void AddArrayGrid(long NumX, long NumZ, const VARIANT& XZArray);

what data type should be passed as a 3rd parameter in this call and how should i do type cast my array of double (double * buf = new[nx*ny];) to VARIANT data type?

Thanks