帮人帮到底,给你做了个例子,我试过的哦
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart, TeeTools;
type
TForm1 = class(TForm)
Chart1: TChart;
Series1: TFastLineSeries;
Series2: TFastLineSeries;
Series3: TFastLineSeries;
Series4: TFastLineSeries;
Button1: TButton;
ChartTool1: TCursorTool;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure FormCreate(Sender: TObject);
procedure ChartTool1Change(Sender: TCursorTool;
x, y: Integer;
const XValue, YValue:do
uble;
Series: TChartSeries;
ValueIndex: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.SeriesList.FillSampleValues(100);
end;
procedure TForm1.ChartTool1Change(Sender: TCursorTool;
x, y: Integer;
const XValue, YValue:do
uble;
Series: TChartSeries;
ValueIndex: Integer);
begin
Label1.Caption := FloatToStrF(XValue, ffNumber, 11, 6);
Label2.Caption := FloatToStrF(YValue, ffNumber, 11, 6);
Label3.Caption := FloatToStrF(Series1.YValue[ValueIndex], ffNumber, 11, 6);
//同Label2
Label4.Caption := FloatToStrF(Series2.YValue[ValueIndex], ffNumber, 11, 6);
Label5.Caption := FloatToStrF(Series3.YValue[ValueIndex], ffNumber, 11, 6);
Label6.Caption := FloatToStrF(Series4.YValue[ValueIndex], ffNumber, 11, 6);
end;