TColorGridSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
rperkins
Newbie
Newbie
Posts: 58
Joined: Wed May 26, 2004 4:00 am

TColorGridSeries

Post by rperkins » Fri Jan 07, 2005 9:02 pm

Hello, I am trying to use a color Grid series on a form and the behavior isnt what I expect or desire. It would seem that it is impossible to have negative X or Z values. I have a function which populates the chart with points starting at the point -11, -11 and ending at point 11, 11. After it is done, the chart displays the axes correctly, running from -11 to 11, but the data appears only in the region of the graph between 0 and 11 for each axis.

Here is the source for the function:

the values of the parameters are:

minPoint = -11,-11
maxPoint = 11,11
spacing = 0.1,0.1
numPoints = 221,221

void TfrmPlanningSystemImport::LoadChartSeriesFromTP(_SNCPointDouble &minPoint,
_SNCPointDouble &maxPoint,_SNCPointDouble &spacing,_SNCPointInt &numPoints,
vector<float> &Dose,double maxDose)
{/*
*/
double xPos=minPoint.x,yPos=minPoint.y;
int i,j,singleIndex=0;
// determine colors from normalized data
singleIndex=0;
Series1->Clear();
Series1->NumXValues = numPoints.x;
Series1->NumZValues = numPoints.y;
for(i=0;i<numPoints.y;i++)
{
for(j=0;j<numPoints.x;j++)
{
Series1->AddXYZ(xPos,Dose[singleIndex++]/maxDose,yPos);
xPos+=spacing.x;
}
yPos+=spacing.y;
xPos=minPoint.x;
}
}


Any assistance would be greatly appreciated. I cant seem to get this to work at all.


Henry Bragg

www.sunnuclear.com

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

Post by Marjan » Mon Jan 10, 2005 8:23 am

Does it help setting Series1->IrregularGrid property to true before you start adding points to series ?
Marjan Slatinek,
http://www.steema.com

rperkins
Newbie
Newbie
Posts: 58
Joined: Wed May 26, 2004 4:00 am

Post by rperkins » Wed Jan 12, 2005 1:11 pm

When I set irregular grid to true, no image appears at all.


Henry

leaf
Newbie
Newbie
Posts: 37
Joined: Fri Nov 15, 2002 12:00 am

Post by leaf » Tue Aug 09, 2005 4:50 pm

Was this ever resolved? I am having the same issue.

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Aug 11, 2005 4:08 pm

Hi,

it seems that this solves the problem. If you still having problems please post the code you're using to populate the ColorGrid Series and I'll try to reproduce your problem.

leaf
Newbie
Newbie
Posts: 37
Joined: Fri Nov 15, 2002 12:00 am

Post by leaf » Wed Aug 17, 2005 2:19 pm

Pep, thanks for your reply...

When you say that "it" solves the problem, what does that mean. Henery's last post indicates the solution did not solve the problem.

Below is two blocks of code. THe one commented out does not work, the other does. The one that is commented out calculates x and z parameters ranging from -3.16 to +3.16 for x and z parameters. I have verified that the calculated values are correct. the image that is generated is not correct when the same y values are put in.

My understand (and I could be wrong) is that the same image should be generated but the axis labels should be different.

for i := 0 to High(DblImageData) do
for j := 0 to High(DblImageData[0]) do
begin
(Chart1.Series[SIndex] as TColorGridSeries).AddXYZ (i,DblImageData[i,j],j);
end;
//
// for i := 0 to High(DblImageData) do
// for j := 0 to High(DblImageData[0]) do
// begin
// (Chart1.Series[SIndex] as TColorGridSeries).AddXYZ(xScaleOff+i*xScaleMul, DblImageData[i,j], zScaleOff+zScaleMul*j);
// //(Chart1.Series[SIndex] as TColorGridSeries).AddXYZ(xScaleOff+i*xScaleMul, DblImageData[i,j], zScaleOff + zScaleMul * (High(DblImageData)-j));
// end;

leaf
Newbie
Newbie
Posts: 37
Joined: Fri Nov 15, 2002 12:00 am

Post by leaf » Wed Aug 17, 2005 5:37 pm

Here, I will even make things simpler. The only difference between the working and non-working code is that I changed the sign of the non-working code.

This code works:

for i := 0 to High(DblImageData) do
for j := 0 to High(DblImageData[0]) do
begin
(Chart1.Series[SIndex] as TColorGridSeries).AddXYZ(i,DblImageData[i,j],j);
end;

This code does not work:

for i := 0 to High(DblImageData) do
for j := 0 to High(DblImageData[0]) do
begin
(Chart1.Series[SIndex] as TColorGridSeries).AddXYZ(-i, DblImageData[i,j], -j);
end;

leaf
Newbie
Newbie
Posts: 37
Joined: Fri Nov 15, 2002 12:00 am

Post by leaf » Sun Aug 28, 2005 4:53 pm

Pep,

I sent you a simple delphi application w/code demonstrating the problem using a TColorGridSeries with the axes going negative. Did you receive it and do you have any comments? I really need to have Negative axis labels on a color grid.

Thanks.

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Aug 29, 2005 11:04 am

Hi,

yes, received it.
In case you enter negative values for XValues or ZValues you'll have to set the IrregularGrid property to True, put the following line before the data is added (before the "for"...). :

(Chart1.Series[0] as TColorGridSeries).IrregularGrid:=true;

Post Reply