好办,这是一个示例的完整源码
---------------------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart;
type
TForm1 = class(TForm)
ColorBox1: TColorBox;
Chart1: TChart;
Button1: TButton;
Series1: TLineSeries;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
i :integer;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
series1.AddXY(i,100);
series1.ValueColor[series1.Count-1] := colorbox1.Selected;
inc(i);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
i:=0;
series1.ColorEachPoint := true;
end;
end.
-----------------------------------------------------------------------------
窗体上包括一个TChart组件,一个TButton组件,一个TColorBox组件,名称均为创建时默认,
注意:Series必须用TlineSeries(TFastLineSeries不好使)。