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

  1. unit uteescro;
  2.  
  3. interface
  4.  
  5. { This example shows the TChartScrollBar component.
  6.  
  7.   You should first install this component in Delphi's
  8.   component library:
  9.  
  10.   Select the TeeScrob.pas unit to install TChartScrollBar.
  11. }
  12. uses
  13.   Wintypes, WinProcs, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  14.   teescrob, ExtCtrls, TeeProcs, TeEngine, Chart, StdCtrls, Buttons, Series;
  15.  
  16. type
  17.   TScrollBarForm = class(TForm)
  18.     Chart1: TChart;
  19.     ChartScrollBar1: TChartScrollBar;
  20.     ChartScrollBar2: TChartScrollBar;
  21.     RadioGroup1: TRadioGroup;
  22.     RadioGroup2: TRadioGroup;
  23.     Button1: TButton;
  24.     Series1: TLineSeries;
  25.     Series2: TLineSeries;
  26.     Memo1: TMemo;
  27.     Button2: TButton;
  28.     VerticalInvert: TCheckBox;
  29.     HorizontalInvert: TCheckBox;
  30.     procedure FormCreate(Sender: TObject);
  31.     procedure Button1Click(Sender: TObject);
  32.     procedure RadioGroup1Click(Sender: TObject);
  33.     procedure RadioGroup2Click(Sender: TObject);
  34.     procedure Button2Click(Sender: TObject);
  35.     procedure VerticalInvertClick(Sender: TObject);
  36.     procedure HorizontalInvertClick(Sender: TObject);
  37.   private
  38.     { Private declarations }
  39.   public
  40.     { Public declarations }
  41.   end;
  42.  
  43. var
  44.   ScrollBarForm: TScrollBarForm;
  45.  
  46. implementation
  47.  
  48. {$R *.DFM}
  49.  
  50. procedure TScrollBarForm.FormCreate(Sender: TObject);
  51. begin  { sample values }
  52.   Series1.FillSampleValues(100);
  53.   Series2.FillSampleValues(100);
  54. end;
  55.  
  56. procedure TScrollBarForm.Button1Click(Sender: TObject);
  57. begin
  58.   Close;
  59. end;
  60.  
  61. procedure TScrollBarForm.RadioGroup1Click(Sender: TObject);
  62. begin
  63.   { set the desired Horizontal axis to scroll (Top or Bottom) }
  64.   { ChartScrollBar1 is the Horizontal scroll bar }
  65.   Case RadioGroup1.ItemIndex of
  66.     0: ChartScrollBar1.Axis:=sbDefault;
  67.     1: ChartScrollBar1.Axis:=sbOther;
  68.     2: ChartScrollBar1.Axis:=sbBoth;
  69.   end;
  70. end;
  71.  
  72. procedure TScrollBarForm.RadioGroup2Click(Sender: TObject);
  73. begin
  74.   { set the desired Vertical axis to scroll (Left or Right) }
  75.   { ChartScrollBar2 is the Vertical scroll bar }
  76.   Case RadioGroup2.ItemIndex of
  77.     0: ChartScrollBar2.Axis:=sbDefault;
  78.     1: ChartScrollBar2.Axis:=sbOther;
  79.     2: ChartScrollBar2.Axis:=sbBoth;
  80.   end;
  81. end;
  82.  
  83. procedure TScrollBarForm.Button2Click(Sender: TObject);
  84. begin
  85.   Chart1.UndoZoom;  { reset scroll and zoom }
  86. end;
  87.  
  88. procedure TScrollBarForm.VerticalInvertClick(Sender: TObject);
  89. begin
  90.   ChartScrollBar2.Inverted:=VerticalInvert.Checked;
  91. end;
  92.  
  93. procedure TScrollBarForm.HorizontalInvertClick(Sender: TObject);
  94. begin
  95.   ChartScrollBar1.Inverted:=HorizontalInvert.Checked;
  96. end;
  97.  
  98. end.
  99.