我碰见了,试了一下,可以实现。如下: procedure TMainForm.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); Var tmpX,tmpY:Double; begin { check if mouse is inside Chart rectangle } if PtInRect( Chart1.ChartRect, Point(X-Chart1.Width3D,Y+Chart1.Height3D) ) then begin With Series1 do begin GetCursorValues(tmpX,tmpY); { <-- get values under mouse cursor } Label2.Caption:=GetVertAxis.LabelValue(tmpY)+ ' '+ GetHorizAxis.LabelValue(tmpX); end; end; end; 其中使用的几个函数是delphi自带的,没有源码。
procedure TMainForm.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
Var tmpX,tmpY:Double;
begin
{ check if mouse is inside Chart rectangle }
if PtInRect( Chart1.ChartRect, Point(X-Chart1.Width3D,Y+Chart1.Height3D) ) then
begin
With Series1 do
begin
GetCursorValues(tmpX,tmpY); { <-- get values under mouse cursor }
Label2.Caption:=GetVertAxis.LabelValue(tmpY)+
' '+
GetHorizAxis.LabelValue(tmpX);
end;
end;
end;
其中使用的几个函数是delphi自带的,没有源码。