Page 1 of 1

CalcPosPoint Precision Error

Posted: Wed Jun 02, 2010 4:24 pm
by 15055543
Hi,

After drawing a series (Polygon), I extracted (X,Y) positions but found there was a differece from the original value with about 0.05 in my case.
I used the following code:

void GetPolygonPoints(IMapPolygonPtr tPolygon, ITChartPtr Chart)
{
IPointArrayPtr vertexPts = tPolygon->GetPoints;
PointD vertPt(0.0,0.0);
for(int i=0; i<vertexPts->Count; i++)
{
vertPt.x = Chart->Axis->Bottom->CalcPosPoint((long)vertexPts->Item->GetX());
vertPt.y = Chart->Axis->Left->CalcPosPoint((long)vertexPts->Item->GetY());
}
}
Is this a known issue or did I do something wrong?
Or is this because I used Polygon?

Dongsu

Re: CalcPosPoint Precision Error

Posted: Thu Jun 03, 2010 2:51 pm
by yeray
Hi Dongsu,

As you've seen, GetPoints gives you the points in pixels where they are drawn. If you want to convert a pixel into an axis value, there is a little error due to internal rounding. This is normal, and I can't think on a workaround for this right now.
On the other hand, in VCL the points in a polygon are accessible (Points.XValue, Points.YValue). I've added to the wish list the possibility to implement this feature in the ActiveX version too (TA05014934).

Re: CalcPosPoint Precision Error

Posted: Thu Jun 03, 2010 5:32 pm
by 15055543
This is not good news. Indeed, I also have used TeeChart in VCL and was able to get non-rounded value.
That's why I tried to find functions in ActiveX as well.

Anyway, thank you.

Dongsu