Page 1 of 1

How to convert a pixel point to a chart point

Posted: Tue Feb 03, 2009 1:30 pm
by 10049371
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

Posted: Tue Feb 03, 2009 2:37 pm
by yeray
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;

Posted: Tue Feb 10, 2009 1:57 pm
by 10049371
Hello Yeray,

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

Marcel