unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Chart1: TChart;
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
 wykres1:TBarSeries;
implementation

{$R *.dfm}

//Dynamiczne tworzenie wykresu:
procedure TForm1.Button1Click(Sender: TObject);
begin
  if wykres1=nil then
   begin
     wykres1:=TBarSeries.Create(Self);
     wykres1.ParentChart:=Chart1;
     wykres1.Add(5);
     wykres1.Add(8);
   end;

end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  wykres1.Free; wykres1:=nil;
end;

end.
