unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Chart1: TChart;
    Button1: TButton;
    Button2: TButton;
    OpenDialog1: TOpenDialog;
    Series1: TBarSeries;
    SeriesTextSource1: TSeriesTextSource;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(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.Button2Click(Sender: TObject);
begin
if OpenDialog1.Execute then
  begin
  SeriesTextSource1.FileName := OpenDialog1.FileName;
  SeriesTextSource1.FieldSeparator := ',';
  SeriesTextSource1.HeaderLines := 0;
  SeriesTextSource1.Series := Series1;
  SeriesTextSource1.Fields[0].FieldIndex := 1;
  SeriesTextSource1.Fields[0].FieldName  := 'X';
  SeriesTextSource1.Fields[1].FieldIndex := 2;
  SeriesTextSource1.Fields[1].FieldName  := 'Text';
  SeriesTextSource1.Fields[2].FieldIndex := 3;
  SeriesTextSource1.Fields[2].FieldName  := 'Bar';
  SeriesTextSource1.Active := true;
  end;
end;

end.
