unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, TeeProcs, TeEngine, Chart, ComCtrls, ExtCtrls, Series,
  TeeBoxPlot, TeeTools, CandleCh, Spin, ColorGrd, OHLChart, Buttons,
  TeeShape;

type
  TForm1 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    TabSheet4: TTabSheet;
    TabSheet5: TTabSheet;
    Chart1: TChart;
    Panel2: TPanel;
    GroupBox1: TGroupBox;
    Chart2: TChart;
    Chart3: TChart;
    Panel3: TPanel;
    GroupBox4: TGroupBox;
    Chart4: TChart;
    Panel4: TPanel;
    GroupBox5: TGroupBox;
    Chart5: TChart;
    Panel5: TPanel;
    GroupBox2: TGroupBox;
    Panel6: TPanel;
    GroupBox3: TGroupBox;
    ChartTool1: TAxisArrowTool;
    ChartTool2: TAxisScrollTool;
    ChartTool3: TColorBandTool;
    ChartTool4: TColorLineTool;
    ChartTool5: TColorLineTool;
    ChartTool6: TGridBandTool;
    CheckBox7: TCheckBox;
    Label1: TLabel;
    ComboBox1: TComboBox;
    CheckBox8: TCheckBox;
    SpinEdit1: TSpinEdit;
    Label2: TLabel;
    ComboBox2: TComboBox;
    Label3: TLabel;
    Label4: TLabel;
    SpinEdit2: TSpinEdit;
    Label5: TLabel;
    ColorGrid1: TColorGrid;
    CheckBox9: TCheckBox;
    CheckBox10: TCheckBox;
    Label6: TLabel;
    ComboBox3: TComboBox;
    CheckBox11: TCheckBox;
    CheckBox12: TCheckBox;
    Label7: TLabel;
    Edit1: TEdit;
    Label8: TLabel;
    Edit2: TEdit;
    CheckBox13: TCheckBox;
    SpinEdit3: TSpinEdit;
    Label9: TLabel;
    Label10: TLabel;
    ColorGrid2: TColorGrid;
    SpeedButton1: TSpeedButton;
    CheckBox14: TCheckBox;
    CheckBox15: TCheckBox;
    CheckBox16: TCheckBox;
    CheckBox17: TCheckBox;
    CheckBox18: TCheckBox;
    Label11: TLabel;
    Edit3: TEdit;
    Label12: TLabel;
    Edit4: TEdit;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    Series1: TVolumeSeries;
    Series2: TFastLineSeries;
    Series3: TBarSeries;
    Series4: TPointSeries;
    Series5: TLineSeries;
    Series6: TFastLineSeries;
    Button2: TButton;
    Button3: TButton;
    CheckBox19: TCheckBox;
    ColorDialog1: TColorDialog;
    ComboBox4: TComboBox;
    Label13: TLabel;
    Label14: TLabel;
    ComboBox5: TComboBox;
    TabSheet6: TTabSheet;
    Button4: TButton;
    procedure ComboBox1Change(Sender: TObject);
    procedure CheckBox8Click(Sender: TObject);
    procedure CheckBox7Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure SpinEdit1Change(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
    procedure ColorGrid1Change(Sender: TObject);
    procedure CheckBox9Click(Sender: TObject);
    procedure CheckBox11Click(Sender: TObject);
    procedure CheckBox12Click(Sender: TObject);
    procedure ComboBox3Change(Sender: TObject);
    procedure CheckBox10Click(Sender: TObject);
    procedure CheckBox13Click(Sender: TObject);
    procedure SpinEdit3Change(Sender: TObject);
    procedure ColorGrid2Change(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure CheckBox14Click(Sender: TObject);
    procedure CheckBox15Click(Sender: TObject);
    procedure CheckBox16Click(Sender: TObject);
    procedure CheckBox17Click(Sender: TObject);
    procedure CheckBox18Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure CheckBox19Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);

    procedure ComboBox4Change(Sender: TObject);
    procedure ComboBox5Change(Sender: TObject);
    procedure TabSheet6Enter(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure SpinEdit2Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ComboBox1Change(Sender: TObject);
begin //设定箭头对应的坐标
case ComboBox1.ItemIndex of
0: ChartTool1.Axis := Chart1.LeftAxis;
1: ChartTool1.Axis := Chart1.BottomAxis;
end;
end;
procedure TForm1.CheckBox8Click(Sender: TObject);
begin
Chart1.View3D := CheckBox8.Checked;
end;

procedure TForm1.CheckBox7Click(Sender: TObject);
begin
ChartTool1.Active := CheckBox7.Checked;
ComboBox1.Enabled := CheckBox7.Checked;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(20);
Series2.FillSampleValues(20);
Series3.AddY(870.0);
Series3.AddY(450.0);
Series3.AddY(700.0);
Series3.AddY(650.0);
Series3.AddY(950.0);
Series3.AddY(210.0);
Series4.FillSampleValues(20);
Series5.FillSampleValues(20);
Series6.FillSampleValues(20);
end;

procedure TForm1.SpinEdit1Change(Sender: TObject);
begin                     //箭头长度
ChartTool1.Length := SpinEdit1.Value ;
end;

procedure TForm1.ComboBox2Change(Sender: TObject);
begin //设定箭头位置
ChartTool1.Position := TAxisArrowToolPosition(ComboBox2.ItemIndex);
end;

procedure TForm1.ColorGrid1Change(Sender: TObject);
begin    //箭头颜色
ChartTool1.Brush.Color := ColorGrid1.ForegroundColor;
end;

procedure TForm1.CheckBox9Click(Sender: TObject);
begin   //激活坐标签工具
ChartTool2.Active := CheckBox9.Checked;
ChartTool2.Axis := Chart2.LeftAxis;

end;

procedure TForm1.CheckBox11Click(Sender: TObject);
begin       //画在之后
ChartTool3.DrawBehind := CheckBox11.Checked;
end;

procedure TForm1.CheckBox12Click(Sender: TObject);
begin      //画在轴之后
ChartTool3.DrawBehindAxes := CheckBox12.Checked;
end;

procedure TForm1.ComboBox3Change(Sender: TObject);
begin
case ComboBox3.ItemIndex of
0:ChartTool3.Axis := Chart2.LeftAxis;
1:ChartTool3.Axis := Chart2.BottomAxis;
end;
end;
procedure TForm1.CheckBox10Click(Sender: TObject);
begin  //激活彩带工具
ChartTool3.Active := CheckBox10.Checked;
end;

procedure TForm1.CheckBox13Click(Sender: TObject);
begin
Chart3.View3D := CheckBox13.Checked;
end;

procedure TForm1.SpinEdit3Change(Sender: TObject);
begin     //彩带透明度
ChartTool3.Transparency := SpinEdit3.Value;
end;


procedure TForm1.ColorGrid2Change(Sender: TObject);
begin     //彩带颜色
ChartTool3.Color :=  ColorGrid2.ForegroundColor;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
 //开始值
ChartTool3.StartValue :=  StrToFloat(Edit1.Text);
//结束值
ChartTool3.EndValue :=  StrToFloat(Edit2.text);
end;

procedure TForm1.CheckBox14Click(Sender: TObject);
begin  //显示线框
ChartTool4.Active := CheckBox14.Checked;
ChartTool5.Active := CheckBox14.Checked;

end;

procedure TForm1.CheckBox15Click(Sender: TObject);
begin
Chart4.View3D :=  CheckBox15.Checked;
end;

procedure TForm1.CheckBox16Click(Sender: TObject);
begin       //3D线框
ChartTool4.Draw3D := CheckBox16.Checked;
ChartTool5.Draw3D := CheckBox16.Checked;
end;

procedure TForm1.CheckBox17Click(Sender: TObject);
begin      //在画之后
ChartTool4.DrawBehind := CheckBox17.Checked;
ChartTool5.DrawBehind := CheckBox17.Checked;
end;

procedure TForm1.CheckBox18Click(Sender: TObject);
begin
   //允许拖拽
ChartTool4.AllowDrag := CheckBox18.Checked;
ChartTool5.AllowDrag := CheckBox18.Checked;
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
ChartTool4.Style := clCustom;
ChartTool4.Value := StrToFloat(Edit3.text);
end;

procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
ChartTool5.Style := clCustom;
ChartTool5.Value := StrToFloat(Edit4.text);

end;

procedure TForm1.CheckBox19Click(Sender: TObject);
begin
Chart5.View3D := CheckBox19.Checked;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if ColorDialog1.Execute then
  ChartTool6.Band1.Color := ColorDialog1.Color;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
if ColorDialog1.Execute then
  ChartTool6.Band2.Color := ColorDialog1.Color;

end;



procedure TForm1.ComboBox4Change(Sender: TObject);
begin
ChartTool6.Band1.Style := TBrushStyle(ComboBox4.ItemIndex);
end;

procedure TForm1.ComboBox5Change(Sender: TObject);
begin
ChartTool6.Band2.Style := TBrushStyle(ComboBox5.ItemIndex);
end;

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

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

procedure TForm1.SpinEdit2Change(Sender: TObject);
begin     //滚动百分比
ChartTool1.ScrollPercent := SpinEdit2.Value;
end;

end.
