Page 1 of 1

TColorGridSeries

Posted: Fri Jan 07, 2005 9:02 pm
by 9232632
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

Posted: Mon Jan 10, 2005 8:23 am
by Marjan
Does it help setting Series1->IrregularGrid property to true before you start adding points to series ?

Posted: Wed Jan 12, 2005 1:11 pm
by 9232632
When I set irregular grid to true, no image appears at all.


Henry

Posted: Tue Aug 09, 2005 4:50 pm
by 8572663
Was this ever resolved? I am having the same issue.

Posted: Thu Aug 11, 2005 4:08 pm
by Pep
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.

Posted: Wed Aug 17, 2005 2:19 pm
by 8572663
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;

Posted: Wed Aug 17, 2005 5:37 pm
by 8572663
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;

Posted: Sun Aug 28, 2005 4:53 pm
by 8572663
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.

Posted: Mon Aug 29, 2005 11:04 am
by Pep
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;