How to convert a pixel point to a chart point

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
MarcelIbis
Newbie
Newbie
Posts: 9
Joined: Tue Jun 10, 2008 12:00 am

How to convert a pixel point to a chart point

Post by MarcelIbis » Tue Feb 03, 2009 1:30 pm

How can I convert a point(x,y) from a mousemove event into a point of the chart x and Y axis?
Thanks in advance.

Marcel

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

Post by Yeray » Tue Feb 03, 2009 2:37 pm

Hi Marcel,

I recommend you to use the axis function CalcPosPoint, for example:

Code: Select all

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Caption := 'X: ' + floattostr(Chart1.Axes.Bottom.CalcPosPoint(X)) + '  Y: ' + floattostr(Chart1.Axes.Left.CalcPosPoint(Y));
end;
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

MarcelIbis
Newbie
Newbie
Posts: 9
Joined: Tue Jun 10, 2008 12:00 am

Post by MarcelIbis » Tue Feb 10, 2009 1:57 pm

Hello Yeray,

Thank you for your suggestion.
Exactly what I needed!!

Marcel

Post Reply