Is there a problem with contour plots or am I doing something silly.
Using Builder 5 and TChart 7 I have code similar to that below
Apologies for using a mistune of coordinate conventions!!!!!
TTeeCommander *TeeCommander1;
TChart *Contourplot;
TSurfaceSeries *Series1;
double xd,yd ;
double tempD;
int xctr, yctr;
double showaray[128][128];
// code to fill showarray goes here
Series1->Clear();
for (xctr = 0; xctr != 128; ++xctr)
{
for (yctr = 0; yctr != 128; ++yctr)
{
xd = xmin + xscale *((double)xctr); // xd runs from -1 to + 1
yd = ymin + yscale *((double)yctr); // yd also from -1 to +1
tempD = showaray[xctr][yctr];
xd = 100.0 * xd ; // these two lines
yd = 100.0 * yd ; // are needed
Series1->AddXYZ(xd, tempD, yd);
}
}
If I leave out the two lines where I increase the values of xd and yd the plot is plain wrong.
With these lines in the plot shape is accurate but obviously the x and z labels are wrong.
I have another TChart and TTeeCommander present on the same form.
Any help will be much appreciated.
Thanks
Allan
Contour series
Hi, Allan.
In case your grid values (x,z) are not integers, you have to set surfae/contour series IrregularGrid property to true before you start adding points. In your case, add the following line right after the Series->Clear(); call:
In case your grid values (x,z) are not integers, you have to set surfae/contour series IrregularGrid property to true before you start adding points. In your case, add the following line right after the Series->Clear(); call:
Code: Select all
Series1->IrregularGrid = true;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com