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
TColorGridSeries
Does it help setting Series1->IrregularGrid property to true before you start adding points to series ?
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
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.
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.
Pep Jorge
http://support.steema.com
http://support.steema.com
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;
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;
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;
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;
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;
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;
Pep Jorge
http://support.steema.com
http://support.steema.com