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

  1. unit MomentumDiv_Function;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Base, StdCtrls, TeEngine, TeeTools, StatChar, Series, ExtCtrls, TeeProcs,
  8.   Chart, ComCtrls;
  9.  
  10. type
  11.   TMomentumDivForm = class(TBaseForm)
  12.     Series1: TLineSeries;
  13.     Series2: TLineSeries;
  14.     TeeFunction1: TMomentumDivFunction;
  15.     ChartTool1: TColorLineTool;
  16.     CheckBox1: TCheckBox;
  17.     Label1: TLabel;
  18.     Edit1: TEdit;
  19.     UpDown1: TUpDown;
  20.     procedure CheckBox1Click(Sender: TObject);
  21.     procedure FormCreate(Sender: TObject);
  22.     procedure Edit1Change(Sender: TObject);
  23.   private
  24.     { Private declarations }
  25.   public
  26.     { Public declarations }
  27.   end;
  28.  
  29. implementation
  30.  
  31. {$R *.DFM}
  32.  
  33. procedure TMomentumDivForm.CheckBox1Click(Sender: TObject);
  34. begin
  35.   { show / hide the momentum series }
  36.   Series2.Active:=CheckBox1.Checked;
  37.  
  38.   { re-position the axis }
  39.   if Series2.Active then Chart1.LeftAxis.EndPosition:=80
  40.                     else Chart1.LeftAxis.EndPosition:=100;
  41.  
  42.   { show / hide the custom right axis }
  43.   Chart1.CustomAxes[0].Visible:=Series2.Active;
  44.  
  45.   { show / hide the blue color line }
  46.   ChartTool1.Active:=Series2.Active;
  47. end;
  48.  
  49. procedure TMomentumDivForm.FormCreate(Sender: TObject);
  50. begin
  51.   inherited;
  52.   Series1.FillSampleValues(50);
  53.  
  54.   { set the correct position for the blue line... }
  55.   ChartTool1.Value:=Series1.YValues.MinValue;
  56.  
  57.   { function is = 100 * Value / (Previous 10th value) }
  58.   TeeFunction1.Period:=10;
  59. end;
  60.  
  61. procedure TMomentumDivForm.Edit1Change(Sender: TObject);
  62. begin
  63.   TeeFunction1.Period:=UpDown1.Position
  64. end;
  65.  
  66. initialization
  67.   RegisterClass(TMomentumDivForm);
  68. end.
  69.