unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBTables, TeEngine, Series, ExtCtrls, TeeProcs, Chart,
  DBChart, StdCtrls;

type
  TForm1 = class(TForm)
    DBChart1: TDBChart;
    Series1: TBarSeries;
    Table1: TTable;
    CheckBox1: TCheckBox;
    Button1: TButton;
    Button2: TButton;
    procedure CheckBox1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
Table1.Active := CheckBox1.Checked;
end;

procedure TForm1.Button1Click(Sender: TObject);
Var
MySeries:TLineSeries;		//定义一个TLineSeries类型的序列MySeries
begin
	MySeries:=TLineSeries.Create( Self );		//在内存中创建MySeries实例
With MySeries do
	begin
		ParentChart:=DBChart1;			//设定序列的ParentChart属性为DBChart1
		DataSource:=Table1;				//设定序列的DataSource为Table1
		XLabelsSource:='Name';			//设定序列的XLabelsSource属性为表中Name
		YValues.ValueSource:= 'SIZE';		//设定YValues.ValueSource的属性为SIZE
 		CheckDatasource;
	end;
Button1.Enabled := false;
end;


procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;

end.
