unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Chart1: TChart;
    BitBtn1: TBitBtn;
    Series1: TBarSeries;
    Series2: TAreaSeries;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    BitBtn4: TBitBtn;
    BitBtn5: TBitBtn;
    BitBtn6: TBitBtn;
    Label1: TLabel;
    Label2: TLabel;
    BitBtn7: TBitBtn;
    Label3: TLabel;
    BitBtn8: TBitBtn;
    procedure BitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure BitBtn5Click(Sender: TObject);
    procedure BitBtn6Click(Sender: TObject);
    procedure BitBtn7Click(Sender: TObject);
    procedure BitBtn8Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
//Chart1.RemoveAllSeries;
Chart1.RemoveSeries(Series1);
Chart1.RemoveSeries(Series2);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(20);
Series2.FillSampleValues(20);
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
Series1.ParentChart := Chart1;
Series2.ParentChart := Chart1;
Chart1.Refresh;
end;

procedure TForm1.BitBtn3Click(Sender: TObject);
begin
Chart1.FreeAllSeries();
end;

procedure TForm1.BitBtn4Click(Sender: TObject);
begin
Series1.FillSampleValues(10);
Series2.FillSampleValues(19);
end;

procedure TForm1.BitBtn5Click(Sender: TObject);
begin
Chart1.GetAxisSeries(Chart1.LeftAxis).Add(1000.0,'123');
Chart1.GetAxisSeries(Chart1.LeftAxis).Add(1500.0,'1');
Chart1.GetAxisSeries(Chart1.LeftAxis).Add(1900.0,'13');
end;

procedure TForm1.BitBtn6Click(Sender: TObject);
begin
Label1.Caption := FloatToStr(Chart1.MaxYValue(Chart1.LeftAxis));
Label2.Caption := FloatToStr(Chart1.MinYValue(Chart1.LeftAxis));
end;

procedure TForm1.BitBtn7Click(Sender: TObject);
begin
Label1.Caption := FloatToStr(Chart1.MaxXValue(Chart1.BottomAxis));
Label2.Caption := FloatToStr(Chart1.MinXValue(Chart1.BottomAxis));
Label3.Caption := FloatToStr(Series1.MaxXValue);
end;

procedure TForm1.BitBtn8Click(Sender: TObject);
begin
Chart1.CopyToClipboardBitmap;
Chart1.CopyToClipboardBitmap(Rect(0,0,400,200));
Chart1.CopyToClipboardMetafile(TRUE);
Chart1.CopyToClipboardMetafile(TRUE,Rect(0,0,400,200));
end;

end.
