Contour series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Allan
Newbie
Newbie
Posts: 5
Joined: Mon Jan 10, 2005 5:00 am
Location: Wadhurst
Contact:

Contour series

Post by Allan » Thu Jan 27, 2005 5:05 pm

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

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Jan 28, 2005 7:20 am

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:

Code: Select all

Series1->IrregularGrid = true;
Marjan Slatinek,
http://www.steema.com

Post Reply