to yostgxf:
我试了无数遍![red]不行[/red]我的代码:
===============unit1.pas=============
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, TeeTools, Series, ExtCtrls, TeeProcs, Chart, StdCtrls;
type
TForm1 = class(TForm)
Chart1: TChart;
Series1: TFastLineSeries;
Series2: TFastLineSeries;
Series3: TFastLineSeries;
ChartTool1: TCursorTool;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: 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 := FloatToStr(XValue);
Label2.Caption := FloatToStr(YValue);
Label3.Caption := FloatToStr(Series1.YValue[ValueIndex]);
Label4.Caption := FloatToStr(Series2.YValue[ValueIndex]);
Label5.Caption := FloatToStr(Series3.YValue[ValueIndex]);
end;
end.
[blue]=============unit1.dfm=================
object Form1: TForm1
Left = 192
Top = 107
Width = 696
Height = 480
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 40
Width = 32
Height = 13
Caption = 'Label1'
end
object Label2: TLabel
Left = 8
Top = 64
Width = 32
Height = 13
Caption = 'Label2'
end
object Label3: TLabel
Left = 8
Top = 88
Width = 32
Height = 13
Caption = 'Label3'
end
object Label4: TLabel
Left = 8
Top = 112
Width = 32
Height = 13
Caption = 'Label4'
end
object Label5: TLabel
Left = 8
Top = 136
Width = 32
Height = 13
Caption = 'Label5'
end
object Chart1: TChart
Left = 128
Top = 32
Width = 553
Height = 345
Title.Text.Strings = (
'TChart')
View3D = False
TabOrder = 0
object Series1: TFastLineSeries
Marks.Callout.Brush.Color = clBlack
Marks.Visible = False
LinePen.Color = clRed
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Y'
YValues.Order = loNone
end
object Series2: TFastLineSeries
Marks.Callout.Brush.Color = clBlack
Marks.Visible = False
LinePen.Color = clGreen
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Y'
YValues.Order = loNone
end
object Series3: TFastLineSeries
Marks.Callout.Brush.Color = clBlack
Marks.Visible = False
LinePen.Color = clYellow
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Y'
YValues.Order = loNone
end
object ChartTool1: TCursorTool
FollowMouse = True
Series = Series1
OnChange = ChartTool1Change
end
end
end[/blue]
除非把:snap:=true !
但snap:=true后移动非常奇怪!
[red]急需等答案!!!!!![/red]