unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants,TeeEditCha, Classes,  Graphics, Controls, Forms,
  Dialogs, TeeSelectorTool, TeeTools, TeePageNumTool, TeeLegendScrollBar,
  TeeTransposeTool, TeEngine, TeeLighting, Series, OHLChart, CandleCh,
  StdCtrls, ExtCtrls, TeeProcs, Chart, ComCtrls, Spin, Grids, TeeInspector,
  TeeNavigator, TeeEdiGene, TeeEdit, TeeSurfa, TeeLisB;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    ChartTool1: TLightTool;
    ChartTool2: TGridTransposeTool;
    ChartTool3: TAnnotationTool;
    ChartTool4: TLegendScrollBar;
    ChartTool5: TPageNumTool;
    ChartTool6: TRectangleTool;
    ChartTool7: TRotateTool;
    ChartTool8: TSelectorTool;
    Series1: TPointSeries;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    Panel1: TPanel;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    TabSheet4: TTabSheet;
    TabSheet5: TTabSheet;
    TabSheet6: TTabSheet;
    Button1: TButton;
    GroupBox1: TGroupBox;
    CheckBox9: TCheckBox;
    ComboBox1: TComboBox;
    Label1: TLabel;
    Label2: TLabel;
    TrackBar1: TTrackBar;
    Label3: TLabel;
    TrackBar2: TTrackBar;
    Label4: TLabel;
    TrackBar3: TTrackBar;
    GroupBox2: TGroupBox;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    CheckBox5: TCheckBox;
    CheckBox6: TCheckBox;
    CheckBox7: TCheckBox;
    CheckBox8: TCheckBox;
    GroupBox3: TGroupBox;
    TeeInspector1: TTeeInspector;
    GroupBox4: TGroupBox;
    Label5: TLabel;
    Edit1: TEdit;
    Label6: TLabel;
    ComboBox2: TComboBox;
    ChartPageNavigator1: TChartPageNavigator;
    Button2: TButton;
    ChartEditor1: TChartEditor;
    TabSheet7: TTabSheet;
    GroupBox5: TGroupBox;
    Label7: TLabel;
    Label8: TLabel;
    ComboBox3: TComboBox;
    ComboBox4: TComboBox;
    Button3: TButton;
    CheckBox10: TCheckBox;
    TabSheet8: TTabSheet;
    GroupBox6: TGroupBox;
    Button4: TButton;
    ColorDialog1: TColorDialog;
    SpinEdit1: TSpinEdit;
    Label9: TLabel;
    CheckBox11: TCheckBox;
    CheckBox12: TCheckBox;
    GroupBox7: TGroupBox;
    Label10: TLabel;
    Edit2: TEdit;
    Label11: TLabel;
    ComboBox5: TComboBox;
    Label12: TLabel;
    ComboBox6: TComboBox;
    GroupBox8: TGroupBox;
    Label13: TLabel;
    ChartListBox1: TChartListBox;
    Button5: TButton;
    Series2: TSurfaceSeries;
    GroupBox9: TGroupBox;
    Label14: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    Edit3: TEdit;
    ComboBox7: TComboBox;
    SpinEdit2: TSpinEdit;
    SpinEdit3: TSpinEdit;
    Label17: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
//    procedure CheckBox3Click(Sender: TObject);
    procedure CheckBox4Click(Sender: TObject);

    procedure CheckBox5Click(Sender: TObject);
    procedure PageControl1Change(Sender: TObject);
    procedure CheckBox9Click(Sender: TObject);
    procedure TrackBar1Change(Sender: TObject);
    procedure TrackBar2Change(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure TrackBar3Change(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure TeeInspector1Items0Change(Sender: TObject);
    procedure TeeInspector1Items1Change(Sender: TObject);
    procedure TeeInspector1Items1GetItems(Sender: TInspectorItem;
      Proc: TGetItemProc);
    procedure TeeInspector1Items6Change(Sender: TObject);
    procedure TeeInspector1Items5Change(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure ComboBox3Change(Sender: TObject);
    procedure CheckBox7Click(Sender: TObject);
    procedure ComboBox4Change(Sender: TObject);
    procedure CheckBox10Click(Sender: TObject);
    procedure CheckBox8Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure CheckBox11Click(Sender: TObject);
    procedure CheckBox12Click(Sender: TObject);
    procedure SpinEdit1Change(Sender: TObject);
    procedure CheckBox6Click(Sender: TObject);
    procedure Edit2Change(Sender: TObject);
    procedure ComboBox5Change(Sender: TObject);
    procedure ComboBox6Change(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure CheckBox3Click(Sender: TObject);
    procedure Edit3Change(Sender: TObject);
    procedure ComboBox7Change(Sender: TObject);
    procedure SpinEdit2Change(Sender: TObject);
    procedure SpinEdit3Change(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.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(20);
ChartTool1.Active := false;
ChartTool2.Active := false;
ChartTool3.Active := false;
ChartTool4.Active := false;
ChartTool5.Active := false;
ChartTool6.Active := false;
ChartTool7.Active := false;
ChartTool8.Active := false;
Series2.Visible := false;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin     //灯光
Series2.Visible := FALSE;
Chart1.Title.Text.Text := '光源工具演示';
ChartTool1.Active := CheckBox1.Checked;
PageControl1.ActivePage := TabSheet1;
TrackBar2.Max :=       ChartTool1.ParentChart.Width;
TrackBar2.Position :=  ChartTool1.ParentChart.Width div 2;
TrackBar3.Max :=       ChartTool1.ParentChart.Height;
TrackBar3.Position :=  ChartTool1.ParentChart.Height div 2;
ChartTool1.Left := TrackBar2.Position;
ChartTool1.Top  := TrackBar3.Position;
ChartTool1.Style := lsLinear;
end;


procedure TForm1.CheckBox4Click(Sender: TObject);
begin     //图例滚动条工具
Series2.Visible := FALSE;
Chart1.Title.Text.Text := '图例滚动条工具演示';
ChartTool4.Active := CheckBox4.Checked;
PageControl1.ActivePage := TabSheet4;
TeeInspector1.Visible := CheckBox4.Checked;
end;



procedure TForm1.CheckBox5Click(Sender: TObject);
begin   //页码工具
Series2.Visible := FALSE;
Chart1.Title.Text.Text := '页码工具演示';
ChartTool5.Active := CheckBox5.Checked;
PageControl1.ActivePage := TabSheet5;
Chart1.MaxPointsPerPage := 5;
ChartTool5.Format := string(Edit1.Text);
end;

procedure TForm1.PageControl1Change(Sender: TObject);
begin
if PageControl1.ActivePage = TabSheet1 then
  begin
  TrackBar2.Max := Chart1.Width;
  TrackBar3.Max := Chart1.Height;
  end;

end;

procedure TForm1.CheckBox9Click(Sender: TObject);
begin    //跟随鼠标
ChartTool1.FollowMouse := CheckBox9.Checked;
end;

procedure TForm1.TrackBar1Change(Sender: TObject);
begin //光源放大因子
ChartTool1.Factor := TrackBar1.Position;
end;


procedure TForm1.ComboBox1Change(Sender: TObject);
begin   //光源类型
if ComboBox1.ItemIndex = 0 then ChartTool1.Style := lsLinear
                           else ChartTool1.Style := lsSpotLight;
end;

procedure TForm1.TrackBar2Change(Sender: TObject);
begin   //灯源左边位置
ChartTool1.Left := TrackBar2.Position;;
end;


procedure TForm1.TrackBar3Change(Sender: TObject);
begin  //灯源上边位置
ChartTool1.Top := TrackBar3.Position;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin //调用图表编辑器的Tools页
ChartEditor1.HighLightTabs := true;
ChartEditor1.DefaultTab := cetTools;
ChartEditor1.Execute;
end;

procedure TForm1.TeeInspector1Items0Change(Sender: TObject);
begin      //图例背景色
ChartTool4.BackColor := TeeInspector1.Items[0].Value;
end;

procedure TForm1.TeeInspector1Items1Change(Sender: TObject);
begin
ChartTool4.Gradient.Visible := TeeInspector1.Items[1].Visible;
end;

procedure TForm1.TeeInspector1Items1GetItems(Sender: TInspectorItem;
  Proc: TGetItemProc);
begin
ShowMessage(Sender.Caption) ;
end;

procedure TForm1.TeeInspector1Items6Change(Sender: TObject);
begin     //图例初始延迟
ChartTool4.InitialDelay := TeeInspector1.Items[6].Value;
end;

procedure TForm1.TeeInspector1Items5Change(Sender: TObject);
begin   //边框
ChartTool4.Bevel := TeeInspector1.Items[5].Value;
end;

procedure TForm1.ComboBox2Change(Sender: TObject);
begin   //页码显示位置
case  ComboBox2.ItemIndex of
0:  ChartTool5.Position := ppLeftTop;
1:  ChartTool5.Position := ppLeftBottom;
2:  ChartTool5.Position := ppRightTop;
3:  ChartTool5.Position := ppRightBottom;
end;

end;

procedure TForm1.Edit1Change(Sender: TObject);
begin //页码格式
ChartTool5.Format := string(Edit1.Text);
end;

procedure TForm1.ComboBox3Change(Sender: TObject);
begin             //旋转风格
case  ComboBox3.ItemIndex of
0: ChartTool7.Style := rsAll;
1: ChartTool7.Style := rsRotation;
2: ChartTool7.Style := rsElevation;
end;
end;

procedure TForm1.CheckBox7Click(Sender: TObject);
begin  //旋转工具
Series2.Visible := FALSE;
Chart1.Title.Text.Text := '旋转工具演示';
ChartTool7.Style := rsAll;
ChartTool7.Inverted   := false;
ChartTool7.Active :=  CheckBox7.Checked;

//ChartTool7.Pen.Color := clRed;
//ChartTool7.Brush.Style :=  bsDiagCross;
PageControl1.ActivePage := TabSheet7;

end;

procedure TForm1.ComboBox4Change(Sender: TObject);
begin    //旋转用鼠标按钮
case  ComboBox4.ItemIndex of
0:  ChartTool7.Button := mbLeft;
1:  ChartTool7.Button := mbMiddle;
2:  ChartTool7.Button := mbRight;
end;
end;

procedure TForm1.CheckBox10Click(Sender: TObject);
begin   //旋转Invertexd
ChartTool7.Inverted := CheckBox10.Checked;
end;

procedure TForm1.CheckBox8Click(Sender: TObject);
begin
Series2.Visible := FALSE;
Chart1.Title.Text.Text := '选择器工具演示';
ChartTool8.Active := CheckBox8.Checked;
PageControl1.ActivePage := TabSheet8;   //打开选择器页
end;

procedure TForm1.Button4Click(Sender: TObject);
begin  //选择点颜色
if ColorDialog1.Execute then
      ChartTool8.Brush.Color := ColorDialog1.Color;
end;

procedure TForm1.CheckBox11Click(Sender: TObject);
begin //选择器拖拽
ChartTool8.AllowDrag := CheckBox11.Checked;
end;

procedure TForm1.CheckBox12Click(Sender: TObject);
begin  //选择器重画图表
ChartTool8.AllowResizeChart :=  CheckBox12.Checked;
end;

procedure TForm1.SpinEdit1Change(Sender: TObject);
begin   //设定选点大小
ChartTool8.HandleSize := SpinEdit1.Value;
end;

procedure TForm1.CheckBox6Click(Sender: TObject);
begin    //矩形工具
Series2.Visible := FALSE;
Chart1.Title.Text.Text := '矩形工具演示';
ChartTool6.Active := CheckBox6.Checked;
PageControl1.ActivePage := TabSheet6;
end;

procedure TForm1.Edit2Change(Sender: TObject);
begin //矩形文本
ChartTool6.Text := Edit2.Text;
end;

procedure TForm1.ComboBox5Change(Sender: TObject);
begin
case ComboBox5.ItemIndex of
0: ChartTool6.TextAlignment :=   taLeftJustify;
1: ChartTool6.TextAlignment  :=  taCenter;
2: ChartTool6.TextAlignment  :=  taRightJustify;
end;
end;

procedure TForm1.ComboBox6Change(Sender: TObject);
begin       //矩形工具显示位置
case  ComboBox6.ItemIndex of
0:  ChartTool6.Position := ppLeftTop;
1:  ChartTool6.Position := ppLeftBottom;
2:  ChartTool6.Position := ppRightTop;
3:  ChartTool6.Position := ppRightBottom;
end;
end;

procedure TForm1.CheckBox2Click(Sender: TObject);
begin   //三维转置
ChartTool2.Active :=CheckBox2.Checked;
Chart1.Title.Text.Text := '三维转置工具演示';
PageControl1.ActivePage := TabSheet2;
if CheckBox2.Checked then
  begin
  Series1.Visible := false;
  Series2.Visible := true;
  Series2.FillSampleValues(50);
  end
  else
  begin
  Series1.Visible := true;
  Series2.Visible := false;
  end;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin  //转置
ChartTool2.Series := Series2;
ChartTool2.Transpose;
Chart1.Refresh;
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
Chart1.BottomAxis.Inverted := TRUE;
Chart1.DepthAxis.Inverted := TRUE;
Chart1.Refresh;
end;

procedure TForm1.CheckBox3Click(Sender: TObject);
begin  //注释工具
Series2.Visible := FALSE;
Chart1.Title.Text.Text := '注释工具演示';
ChartTool3.Active := CheckBox3.Checked;
PageControl1.ActivePage := TabSheet3;
end;

procedure TForm1.Edit3Change(Sender: TObject);
begin
ChartTool3.Text := Edit3.Text;
end;

procedure TForm1.ComboBox7Change(Sender: TObject);
begin      //注释中的文本对齐
case ComboBox7.ItemIndex of
0: ChartTool3.TextAlignment :=   taLeftJustify;
1: ChartTool3.TextAlignment  :=  taCenter;
2: ChartTool3.TextAlignment  :=  taRightJustify;
end;
end;

procedure TForm1.SpinEdit2Change(Sender: TObject);
begin   //注释的左边位置
ChartTool3.Shape.Left := SpinEdit2.Value;
end;

procedure TForm1.SpinEdit3Change(Sender: TObject);
begin   //注释的上部位置
ChartTool3.Shape.Top := SpinEdit3.Value;
end;

end.
