home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Delphi / TeeChartPro / TeeChart5Delphi5Eval.exe / %MAINDIR% / Examples / Features / Axis_LabelAlign.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-09-10  |  1.8 KB  |  66 lines

  1. {$I TeeDefs.inc}
  2. unit Axis_LabelAlign;
  3.  
  4. interface
  5.  
  6. uses
  7.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  8.   Base, StdCtrls, ExtCtrls, TeEngine, Series, TeeProcs, Chart;
  9.  
  10. type
  11.   TAxisLabelAlignForm = class(TBaseForm)
  12.     Series1: THorizBarSeries;
  13.     CheckBox1: TCheckBox;
  14.     RadioGroup1: TRadioGroup;
  15.     procedure RadioGroup1Click(Sender: TObject);
  16.     procedure CheckBox1Click(Sender: TObject);
  17.     procedure FormCreate(Sender: TObject);
  18.   private
  19.     { Private declarations }
  20.   public
  21.     { Public declarations }
  22.   end;
  23.  
  24. implementation
  25.  
  26. {$R *.dfm}
  27.  
  28. procedure TAxisLabelAlignForm.RadioGroup1Click(Sender: TObject);
  29. begin
  30.   { switch between the Left and Right axis }
  31.   if RadioGroup1.ItemIndex=0 then Series1.VertAxis:=aLeftAxis
  32.                              else Series1.VertAxis:=aRightAxis;
  33.   CheckBox1Click(Self);
  34. end;
  35.  
  36. procedure TAxisLabelAlignForm.CheckBox1Click(Sender: TObject);
  37. begin
  38.   if CheckBox1.Checked then
  39.      Series1.GetVertAxis.LabelsAlign:=alOpposite
  40.   else
  41.      Series1.GetVertAxis.LabelsAlign:=alDefault;
  42. end;
  43.  
  44. procedure TAxisLabelAlignForm.FormCreate(Sender: TObject);
  45. begin
  46.   inherited;
  47.  
  48.   { Sample values }
  49.   Series1.Add( 278, 'Africa'   {$IFNDEF D4},clTeeColor{$ENDIF});
  50.   Series1.Add( 123, 'America'  {$IFNDEF D4},clTeeColor{$ENDIF});
  51.   Series1.Add( 321, 'Asia'     {$IFNDEF D4},clTeeColor{$ENDIF});
  52.   Series1.Add( 432, 'Australia'{$IFNDEF D4},clTeeColor{$ENDIF});
  53.   Series1.Add(  89, 'Europe'   {$IFNDEF D4},clTeeColor{$ENDIF});
  54.   Series1.Add( 300, 'Moon'     {$IFNDEF D4},clTeeColor{$ENDIF});
  55.  
  56.   Series1.Marks.Style:=smsPercent;  { show % values }
  57.  
  58.   { Set axes labels to "opposite" alignment }
  59.   Chart1.LeftAxis.LabelsAlign:=alOpposite;
  60.   Chart1.RightAxis.LabelsAlign:=alOpposite;
  61. end;
  62.  
  63. initialization
  64.   RegisterClass( TAxisLabelAlignForm );
  65. end.
  66.