unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeEngine, TeeTools, Series, StdCtrls, ComCtrls, TeeProcs, Chart,
  ExtCtrls, Spin, TeePieTool, TeeGanttTool, GanttCh, Buttons, TeeSurfa,
  TeeSurfaceTool, TeeTransposeTool, TeeSeriesBandTool, ColorGrd;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    TabSheet4: TTabSheet;
    TabSheet5: TTabSheet;
    GroupBox1: TGroupBox;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    CheckBox5: TCheckBox;
    CheckBox6: TCheckBox;
    CheckBox7: TCheckBox;
    Button1: TButton;
    Chart1: TChart;
    Series1: TBarSeries;
    ChartTool1: TSeriesAnimationTool;
    Panel2: TPanel;
    GroupBox2: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    ComboBox1: TComboBox;
    ScrollBar1: TScrollBar;
    CheckBox11: TCheckBox;
    Edit1: TEdit;
    SpinEdit1: TSpinEdit;
    ComboBox2: TComboBox;
    Button2: TButton;
    ComboBox3: TComboBox;
    Button3: TButton;
    Panel3: TPanel;
    GroupBox3: TGroupBox;
    Chart2: TChart;
    ChartTool2: TPieTool;
    Series2: TPieSeries;
    RadioGroup1: TRadioGroup;
    Panel4: TPanel;
    Chart3: TChart;
    Series3: TGanttSeries;
    ChartTool3: TGanttTool;
    Label7: TLabel;
    ComboBox4: TComboBox;
    ScrollBar2: TScrollBar;
    Label8: TLabel;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    CheckBox12: TCheckBox;
    CheckBox13: TCheckBox;
    ComboBox5: TComboBox;
    Label9: TLabel;
    Panel5: TPanel;
    Chart4: TChart;
    ChartTool4: TSurfaceNearestTool;
    Button4: TButton;
    Series4: TSurfaceSeries;
    Panel6: TPanel;
    Chart5: TChart;
    Series5: TFastLineSeries;
    ChartTool5: TDrawLineTool;
    CheckBox14: TCheckBox;
    CheckBox15: TCheckBox;
    ComboBox6: TComboBox;
    Label10: TLabel;
    Label11: TLabel;
    ComboBox7: TComboBox;
    Label12: TLabel;
    Label13: TLabel;
    TabSheet6: TTabSheet;
    Chart6: TChart;
    ChartTool6: TSeriesBandTool;
    Series6: TFastLineSeries;
    Series7: TFastLineSeries;
    Panel7: TPanel;
    Label14: TLabel;
    ComboBox8: TComboBox;
    ColorGrid1: TColorGrid;
    TabSheet7: TTabSheet;
    Chart7: TChart;
    ChartTool7: TClipSeriesTool;
    Panel8: TPanel;
    Series8: TLineSeries;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure CheckBox11Click(Sender: TObject);
    procedure Edit1Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
    procedure SpinEdit1Change(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure ComboBox3Change(Sender: TObject);
    procedure ScrollBar1Change(Sender: TObject);
    procedure Button3Click(Sender: TObject);
 
    procedure Button4Click(Sender: TObject);
    procedure RadioGroup1Click(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure CheckBox3Click(Sender: TObject);
    procedure CheckBox12Click(Sender: TObject);
    procedure CheckBox13Click(Sender: TObject);
    procedure ComboBox4Change(Sender: TObject);
    procedure CheckBox4Click(Sender: TObject);
    procedure CheckBox5Click(Sender: TObject);
    procedure CheckBox14Click(Sender: TObject);
    procedure CheckBox15Click(Sender: TObject);
    procedure ComboBox6Change(Sender: TObject);
    procedure ChartTool5Select(Sender: TObject);
    procedure ChartTool5Selecting(Sender: TDrawLineTool; Line: TDrawLine;
      var AllowSelect: Boolean);
    procedure CheckBox6Click(Sender: TObject);
    procedure ComboBox8Change(Sender: TObject);
    procedure ColorGrid1Click(Sender: TObject);
    procedure CheckBox7Click(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

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

procedure TForm1.ComboBox1Change(Sender: TObject);
begin  //动画的序列
ChartTool1.Series := Series1;
end;

procedure TForm1.CheckBox11Click(Sender: TObject);
begin //在指定Min Value开始
Edit1.Enabled := not  CheckBox11.Checked;
ChartTool1.StartAtMin := CheckBox11.Checked;
end;

procedure TForm1.Edit1Click(Sender: TObject);
begin      //

end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
ChartTool1.StartValue := StrToFloat(Edit1.Text);
end;

procedure TForm1.ComboBox2Change(Sender: TObject);
begin  //动画循环
ChartTool1.Loop := TSeriesAnimationLoop(ComboBox2.ItemIndex);
end;

procedure TForm1.SpinEdit1Change(Sender: TObject);
begin //动画工具的DrawEvery
ChartTool1.DrawEvery := SpinEdit1.Value;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin  // 动画工具
PageControl1.ActivePage := TabSheet1;
ChartTool1.Active := CheckBox1.Checked;
Button2.Enabled   := CheckBox1.Checked;
Chart1.Title.Text.Text := '序列动画工具演示'
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ChartTool1.Active := FALSE;
ChartTool2.Active := FALSE;
ChartTool3.Active := FALSE;
ChartTool4.Active := FALSE;
ChartTool5.Active := FALSE;
ChartTool6.Active := FALSE;
ChartTool7.Active := FALSE;
Series1.FillSampleValues(8);    //BarSeries  CHART1
Series2.FillSampleValues(5);    //PieSeries  CHART2
Series3.FillSampleValues(4);      //GanttSeries Chart3
Series4.FillSampleValues(10);      //SurfacessSeries Chart4
Series5.FillSampleValues(60);      //Fatst Line Chart5
Series6.FillSampleValues(60);      //FastLineSeries Chart6
Series7.FillSampleValues(60);      //FastLinesSeries Chart6
Series8.FillSampleValues(30);      //TAreaSeries Chart7
end;

procedure TForm1.Button2Click(Sender: TObject);
begin    //执行动画
ChartTool1.Execute;
end;

procedure TForm1.ComboBox3Change(Sender: TObject);
begin
Series1.BarStyle := TBarStyle(ComboBox3.ItemIndex);
Chart1.Refresh;
end;

procedure TForm1.ScrollBar1Change(Sender: TObject);
begin     //动画步长
ChartTool1.Steps := ScrollBar1.Position;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
ChartTool1.Stop;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin     //转置
//ChartTool5.Series := Series4;
//ChartTool5.Active :=  TRUE;
//ChartTool5.Transpose;
end;

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
ChartTool2.Style := TPieToolStyle(RadioGroup1.ItemIndex);
Chart2.Refresh;
end;



procedure TForm1.CheckBox2Click(Sender: TObject);
begin      //小饼焦点工具
PageControl1.ActivePage := TabSheet2;
ChartTool2.Series := Series2; //PieSeries
ChartTool2.Active := CheckBox2.Checked;
ChartTool2.Style := TPieToolStyle(RadioGroup1.ItemIndex);
Chart2.Title.Text.Text := '小饼焦点工具演示'
end;







procedure TForm1.CheckBox3Click(Sender: TObject);
begin      //甘特拖拽工具
PageControl1.ActivePage := TabSheet3;
ChartTool3.Series := Series3; //GattSeries
ChartTool3.Active := CheckBox3.Checked;
Chart3.Title.Text.Text := '甘特工具演示'
end;

procedure TForm1.CheckBox12Click(Sender: TObject);
begin    //甘特
ChartTool3.AllowDrag := CheckBox12.Checked;
end;

procedure TForm1.CheckBox13Click(Sender: TObject);
begin   //甘特
ChartTool3.AllowResize :=  CheckBox13.Checked;
end;

procedure TForm1.ComboBox4Change(Sender: TObject);
begin
case ComboBox4.ItemIndex of
0: Chart3.MaxPointsPerPage := 0;
1: Chart3.MaxPointsPerPage := 7;
2: Chart3.MaxPointsPerPage := 15;
3: Chart3.MaxPointsPerPage := 30;
end;

Chart3.Refresh;
end;

procedure TForm1.CheckBox4Click(Sender: TObject);
begin //最近面工具
PageControl1.ActivePage := TabSheet4;
ChartTool4.Series := Series4; //Surface NearestSeries
ChartTool4.Active := CheckBox4.Checked;
Chart4.Title.Text.Text := '最近面工具演示'
end;



procedure TForm1.CheckBox5Click(Sender: TObject);
begin   //画线工具
PageControl1.ActivePage := TabSheet5;
ChartTool5.Series := Series5; //TFastLineSeries;
ChartTool5.Active := CheckBox5.Checked;
Chart5.Title.Text.Text := '画线工具演示'
end;

procedure TForm1.CheckBox14Click(Sender: TObject);
begin    //允许画线
ChartTool5.EnableDraw := CheckBox14.Checked;
end;

procedure TForm1.CheckBox15Click(Sender: TObject);
begin   //允许选择
ChartTool5.EnableSelect := CheckBox15.Checked;

end;

procedure TForm1.ComboBox6Change(Sender: TObject);
begin
ChartTool5.Button := TMouseButton(ComboBox6.ItemIndex);
end;

procedure TForm1.ChartTool5Select(Sender: TObject);
begin
  Label12.Caption := '选:'+FloatToStr(Round(ChartTool5.Selected.StartPos.X))+' , '+FloatToStr(Round(ChartTool5.Selected.StartPos.Y));
  Label13.Caption := '中:'+FloatToStr(Round(ChartTool5.Selected.EndPos.X))+' , '+FloatToStr(Round(ChartTool5.Selected.EndPos.Y));
end;

procedure TForm1.ChartTool5Selecting(Sender: TDrawLineTool;
  Line: TDrawLine; var AllowSelect: Boolean);
begin
  Label12.Caption := '从'+FloatToStr(Line.StartPos.X)+','+FloatToStr(Line.StartPos.Y);
  Label13.Caption := '到'+FloatToStr(Line.EndPos.X)+','+FloatToStr(Line.EndPos.Y);

end;

procedure TForm1.CheckBox6Click(Sender: TObject);
begin  //序列带工具
PageControl1.ActivePage := TabSheet6;
ChartTool6.Series  := Series6; //TFastLineSeries;
ChartTool6.Series2 := Series7; //TFastLineSeries;
ChartTool6.Active := CheckBox6.Checked;
Chart6.Title.Text.Text := '序列带工具演示' ;
ChartTool6.Brush.Style := bsVertical;
end;

procedure TForm1.ComboBox8Change(Sender: TObject);
begin
ChartTool6.Brush.Style := TBrushStyle(ComboBox8.ItemIndex);
end;

procedure TForm1.ColorGrid1Click(Sender: TObject);
begin
ChartTool6.Brush.Color := ColorGrid1.ForegroundColor;
end;

procedure TForm1.CheckBox7Click(Sender: TObject);
begin //剪裁序列工具
PageControl1.ActivePage := TabSheet7;
ChartTool7.Series := Series8; //TFastLineSeries;
ChartTool7.Active := CheckBox7.Checked;
Chart7.Title.Text.Text := '剪裁序列工具' ;
end;

end.
