home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / TEECHART / Delphi1_And_Delphi2 / EXAMPLES / EXTENDED / UGALLERY.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-10-24  |  2.1 KB  |  96 lines

  1. unit Ugallery;
  2.  
  3. { Showing a customized TeeChart gallery. }
  4.  
  5. interface
  6.  
  7. uses
  8.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  9.   Forms, Dialogs, TeEngine, Series, StdCtrls, ExtCtrls, TeeProcs, Chart;
  10.  
  11. type
  12.   TCustomGalleryForm = class(TForm)
  13.     Chart1: TChart;
  14.     Button1: TButton;
  15.     Button2: TButton;
  16.     Show3D: TCheckBox;
  17.     ShowFunctions: TCheckBox;
  18.     ShowDefault: TCheckBox;
  19.     Series1: TPointSeries;
  20.     procedure Button2Click(Sender: TObject);
  21.     procedure Button1Click(Sender: TObject);
  22.     procedure FormCreate(Sender: TObject);
  23.   private
  24.     { Private declarations }
  25.   public
  26.     { Public declarations }
  27.     Procedure ShowMyGallery;
  28.   end;
  29.  
  30. var
  31.   CustomGalleryForm: TCustomGalleryForm;
  32.  
  33. implementation
  34.  
  35. {$R *.DFM}
  36.  
  37. Uses TeeGally;  { <-- the gallery code is in this unit }
  38.  
  39. Procedure TCustomGalleryForm.ShowMyGallery;
  40. var tmp:TChartSeries;
  41. begin
  42.   With TTeeGallery.Create(Self) do  { <-- create the gallery }
  43.   try
  44.     { first thing to do, set chart types...}
  45.     CreateGalleryList([ TBarSeries,
  46.                         TLineSeries,
  47.                         TPointSeries,
  48.                         TPieSeries ]);
  49.  
  50.     { rows and columns... }
  51.     GalleryPanel.NumCols:=2;
  52.     GalleryPanel.NumRows:=2;
  53.  
  54.     { dimensions... }
  55.     Width:=320;
  56.     Height:=320;
  57.  
  58.     { show 3D? }
  59.     CB3D.Checked:=Show3D.Checked;
  60.  
  61.     { show Default? }
  62.     if ShowDefault.Checked then
  63.        GalleryPanel.SelectedSeries:=Series1;
  64.  
  65.     { show Functions? }
  66.     if not ShowFunctions.Checked then HideFunctions;
  67.  
  68.     { run... }
  69.     if ShowModal=mrOk then
  70.     begin
  71.       { change the Series class choosen by the user... }
  72.       tmp:=Series1;
  73.       ChangeSeriesType(tmp,TChartSeriesClass(GalleryPanel.SelectedChart[0].ClassType));
  74.     end;
  75.   finally
  76.     Free;
  77.   end;
  78. end;
  79.  
  80. procedure TCustomGalleryForm.Button2Click(Sender: TObject);
  81. begin
  82.   Close;
  83. end;
  84.  
  85. procedure TCustomGalleryForm.Button1Click(Sender: TObject);
  86. begin
  87.   ShowMyGallery;
  88. end;
  89.  
  90. procedure TCustomGalleryForm.FormCreate(Sender: TObject);
  91. begin
  92.   Series1.FillSampleValues(10);
  93. end;
  94.  
  95. end.
  96.