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

  1. {****************************************}
  2. {    TeeChart. TChart Component          }
  3. { Copyright (c) 1995-98 by David Berneda }
  4. {    All Rights Reserved                 }
  5. {****************************************}
  6. unit UMulab;
  7.  
  8. interface
  9.  
  10. uses
  11.   WinProcs,WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  12.   TeEngine, Series, TeeProcs, Chart, StdCtrls, ExtCtrls;
  13.  
  14. type
  15.   TMultiLineLabelsForm = class(TForm)
  16.     Panel1: TPanel;
  17.     Memo1: TMemo;
  18.     Button1: TButton;
  19.     CheckBox1: TCheckBox;
  20.     Chart1: TChart;
  21.     Series1: TBarSeries;
  22.     Label1: TLabel;
  23.     ComboBox1: TComboBox;
  24.     procedure Button1Click(Sender: TObject);
  25.     procedure FormShow(Sender: TObject);
  26.     procedure CheckBox1Click(Sender: TObject);
  27.     procedure ComboBox1Change(Sender: TObject);
  28.   private
  29.     { Private declarations }
  30.   public
  31.     { Public declarations }
  32.     Procedure FillBars;
  33.   end;
  34.  
  35. implementation
  36.  
  37. {$R *.DFM}
  38.  
  39. procedure TMultiLineLabelsForm.Button1Click(Sender: TObject);
  40. begin
  41.   Close;
  42. end;
  43.  
  44. procedure TMultiLineLabelsForm.FormShow(Sender: TObject);
  45. begin
  46.   { leave space for labels... }
  47.   Chart1.MarginBottom:=15;
  48.   ComboBox1.ItemIndex:=0;
  49.   FillBars;
  50. end;
  51.  
  52. procedure TMultiLineLabelsForm.CheckBox1Click(Sender: TObject);
  53. begin
  54.   FillBars;
  55. end;
  56.  
  57. Procedure TMultiLineLabelsForm.FillBars;
  58. var tmp:String;
  59. begin
  60.   if CheckBox1.Checked then tmp:=TeeLineSeparator
  61.                        else tmp:=' ';
  62.  
  63.   { add Bars with labels... }
  64.   Series1.Clear;
  65.   Series1.Add( 1234, 'John'+tmp+'Smith', clTeeColor );
  66.   Series1.Add( 2212, 'Andy'+tmp+'Jones', clTeeColor );
  67.   Series1.Add( 3214, 'Peter'+tmp+'Green'+tmp+'Jr.', clTeeColor );
  68. end;
  69.  
  70. procedure TMultiLineLabelsForm.ComboBox1Change(Sender: TObject);
  71. begin
  72.   Case ComboBox1.ItemIndex of
  73.     0: Chart1.BottomAxis.LabelsAngle:=0;
  74.     1: Chart1.BottomAxis.LabelsAngle:=90;
  75.     2: Chart1.BottomAxis.LabelsAngle:=180;
  76.   else
  77.     {3: } Chart1.BottomAxis.LabelsAngle:=270;
  78.   end;
  79.   if (ComboBox1.ItemIndex=1) or (ComboBox1.ItemIndex=3) then
  80.      Chart1.MarginBottom:=5
  81.   else
  82.      Chart1.MarginBottom:=15;
  83. end;
  84.  
  85. end.
  86.