delphi chart控件问题

2025-05-18 13:38:22
推荐回答(2个)
回答1:

procedure TForm1.Chart1ClickSeries(Sender: TCustomChart;

  Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton;

  Shift: TShiftState; X, Y: Integer);

begin

  edit1.text:=inttostr(x);

  edit2.text:=inttostr(y);

end;

 

procedure TForm1.FormCreate(Sender: TObject);

var

  a:integer;

begin

  for a:=0 to 100 do

    chart1.Series[0].AddXY(a,random(100))

end;

 

 

鼠标移动我暂时办不到,单击曲线的时候显示是可以做到的

 

回答2:

在MouseMove事件内添加代码即可
以下是在Form下面建立两个label的例子。
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
Label1.Caption:=inttostr(x);
Label2.Caption:=inttostr(y);
end;