unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart, StdCtrls, Buttons,
  TeeTools, TeeScroB, TeeNavigator, TeeEdiGene;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    BitBtn1: TBitBtn;
    Timer1: TTimer;
    Label1: TLabel;
    ComboBox1: TComboBox;
    ChartTool1: TAxisScrollTool;
    RadioGroup1: TRadioGroup;
    CheckBox1: TCheckBox;
    Series1: TLineSeries;
    procedure FormCreate(Sender: TObject);

    procedure ComboBox1Change(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  n:integer = 0;
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
//Series1.FillSampleValues(100);
end;



procedure TForm1.ComboBox1Change(Sender: TObject);
begin
case ComboBox1.ItemIndex of
0: Timer1.Interval := 1000;
1: Timer1.Interval := 500;
2: Timer1.Interval := 100;
end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
n:=Random(100);
Series1.Add(n,TimeToStr(Time));
Series1.RefreshSeries;
if RadioGroup1.ItemIndex= 0 then
  begin
  if Series1.Count >100 then
      ChartTool1.Axis.Scroll(1.0);
  end
  else if RadioGroup1.ItemIndex= 1 then
          begin
          Chart1.BottomAxis.Automatic := true;
          end;

end;

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





procedure TForm1.CheckBox1Click(Sender: TObject);
begin
Timer1.Enabled := CheckBox1.Checked;
end;

end.
