CalcPosPoint Precision Error

TeeChart for ActiveX, COM and ASP
Post Reply
Dongsu
Newbie
Newbie
Posts: 6
Joined: Wed Mar 31, 2010 12:00 am

CalcPosPoint Precision Error

Post by Dongsu » Wed Jun 02, 2010 4:24 pm

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

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: CalcPosPoint Precision Error

Post by Yeray » Thu Jun 03, 2010 2:51 pm

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).
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Dongsu
Newbie
Newbie
Posts: 6
Joined: Wed Mar 31, 2010 12:00 am

Re: CalcPosPoint Precision Error

Post by Dongsu » Thu Jun 03, 2010 5:32 pm

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

Post Reply