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

  1. unit Axis_MultiScroll;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Base, StdCtrls, CandleCh, Series, OHLChart, TeEngine, ExtCtrls, TeeProcs,
  8.   Chart;
  9.  
  10. type
  11.   TMultiAxisScroll = class(TBaseForm)
  12.     Series1: TFastLineSeries;
  13.     Series2: TFastLineSeries;
  14.     Series3: TCandleSeries;
  15.     Series4: TVolumeSeries;
  16.     Label1: TLabel;
  17.     CheckBoxRed: TCheckBox;
  18.     CheckBoxBlue: TCheckBox;
  19.     CheckBoxGreen: TCheckBox;
  20.     procedure FormCreate(Sender: TObject);
  21.     procedure Chart1Scroll(Sender: TObject);
  22.   private
  23.     { Private declarations }
  24.   public
  25.     { Public declarations }
  26.     Green,Blue:TChartAxis;
  27.   end;
  28.  
  29. implementation
  30.  
  31. {$R *.DFM}
  32.  
  33. Uses TeCanvas;
  34.  
  35. procedure TMultiAxisScroll.FormCreate(Sender: TObject);
  36. begin
  37.   inherited;
  38.   Series1.FillSampleValues(100);
  39.   Series2.FillSampleValues(100);
  40.   Series3.FillSampleValues(100);
  41.   Series4.FillSampleValues(100);
  42.  
  43.   { change the Left axis properties }
  44.   With Chart1.LeftAxis do
  45.   begin
  46.     Axis.Color:=clRed;
  47.     StartPosition:=0;
  48.     EndPosition:=33;
  49.   end;
  50.  
  51.   { create custom axes. This can be done at design-time
  52.     with the chart editor. }
  53.   Green:=TChartAxis.Create(Chart1.CustomAxes);
  54.   With Green do
  55.   begin
  56.    Axis.Color:=clGreen;
  57.    StartPosition:=33;
  58.    EndPosition:=66;
  59.   end;
  60.  
  61.   Blue:=TChartAxis.Create(Chart1.CustomAxes);
  62.   With Blue do
  63.   begin
  64.    Axis.Color:=clBlue;
  65.    StartPosition:=66;
  66.    EndPosition:=100;
  67.   end;
  68.  
  69.   { associate series }
  70.   Series1.VertAxis:=aLeftAxis;
  71.   Series2.VertAxis:=aLeftAxis;
  72.   Series3.CustomVertAxis:=Green;
  73.   Series4.CustomVertAxis:=Blue;
  74. end;
  75.  
  76. { limit scroll }
  77. procedure TMultiAxisScroll.Chart1Scroll(Sender: TObject);
  78. var tmpMin, tmpMax : Double;
  79. begin
  80.   if not CheckBoxRed.Checked then
  81.   begin
  82.     tmpMin:=MinDouble(Series1.YValues.MinValue,Series2.YValues.MinValue);
  83.     tmpMax:=MaxDouble(Series1.YValues.MaxValue,Series2.YValues.MaxValue);
  84.     Chart1.LeftAxis.SetMinMax(tmpMin,tmpMax);
  85.   end;
  86.  
  87.   if not CheckBoxGreen.Checked then
  88.      Green.SetMinMax(Series3.YValues.MinValue,Series3.YValues.MaxValue);
  89.  
  90.   if not CheckBoxBlue.Checked then
  91.      Blue.SetMinMax(Series4.YValues.MinValue,Series4.YValues.MaxValue);
  92. end;
  93.  
  94. initialization
  95.   RegisterClass(TMultiAxisScroll);
  96. end.
  97.