home *** CD-ROM | disk | FTP | other *** search
- {*********************************************}
- { TeeChart Delphi Component Library }
- { Polar Series Type Demo }
- { Copyright (c) 1995-1996 by David Berneda }
- { All rights reserved }
- {*********************************************}
- unit UPolar;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs,TeePolar, ExtCtrls, Teengine, Chart, Series, StdCtrls,
- Buttons, TeeProcs, TeeComma;
-
- type
- TPolarForm = class(TForm)
- Chart1: TChart;
- PolarSeries1: TPolarSeries;
- PolarSeries2: TPolarSeries;
- Panel1: TPanel;
- BitBtn2: TBitBtn;
- CheckBox1: TCheckBox;
- Timer1: TTimer;
- CheckBox2: TCheckBox;
- TeeCommander1: TTeeCommander;
- CheckBox3: TCheckBox;
- procedure FormCreate(Sender: TObject);
- procedure BitBtn1Click(Sender: TObject);
- procedure CheckBox1Click(Sender: TObject);
- procedure Timer1Timer(Sender: TObject);
- procedure CheckBox2Click(Sender: TObject);
- procedure PolarSeries1Click(Sender: TChartSeries; ValueIndex: Integer;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- procedure Chart1AfterDraw(Sender: TObject);
- procedure CheckBox3Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- implementation
-
- {$R *.DFM}
- Uses EditChar,PolarEdi;
-
- procedure TPolarForm.FormCreate(Sender: TObject);
- begin
- PolarSeries1.FillSampleValues(20);
- PolarSeries1.Cursor:=crTeeHand;
-
- PolarSeries2.FillSampleValues(25);
- PolarSeries2.Cursor:=crTeeHand;
- end;
-
- procedure TPolarForm.BitBtn1Click(Sender: TObject);
- begin
- EditChart(Self,Chart1);
- end;
-
- procedure TPolarForm.CheckBox1Click(Sender: TObject);
- begin
- Timer1.Enabled:=CheckBox1.Checked;
- end;
-
- procedure TPolarForm.Timer1Timer(Sender: TObject);
- begin
- Timer1.Enabled:=False;
-
- { Move Points !!! }
- PolarSeries1.Rotate(5);
- PolarSeries2.Rotate(355);
-
- { Change Grid Lines and Horizontal Axis Labels }
- With Chart1.BottomAxis do
- if (Increment=0) or (Increment>=90) then
- Increment:=1
- else
- Increment:=Increment+2;
-
- { Change Grid RINGS and Vertical Axis Labels }
- With Chart1.LeftAxis do
- if (Increment=0) or (Increment>=((Maximum-Minimum)/2.0)) then
- Increment:=((Maximum-Minimum)/20.0)
- else
- Increment:=2.0*Increment;
-
- Timer1.Enabled:=True;
- end;
-
- procedure TPolarForm.CheckBox2Click(Sender: TObject);
- begin
- PolarSeries1.Circled:=CheckBox2.Checked;
- end;
-
- procedure TPolarForm.PolarSeries1Click(Sender: TChartSeries;
- ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X,
- Y: Integer);
- begin
- ShowMessage('You clicked: '+Sender.Name+#13+
- 'Angle : '+FloatToStr(Sender.XValue[ValueIndex])+#13+
- 'Radius: '+FloatToStr(Sender.YValue[ValueIndex]));
- end;
-
- procedure TPolarForm.Chart1AfterDraw(Sender: TObject);
- begin
- Chart1.Canvas.Brush.Style:=bsClear; { <-- IMPORTANT (Try without) !!! }
-
- Chart1.Canvas.Pen.Width:= 2;
-
- { Draw a blue ring passing over the 3rd PolarSeries1 Point }
- Chart1.Canvas.Pen.Color:=clBlue;
- With PolarSeries1 do DrawRing( YValue[2], EndZ );
-
- { Draw a green ring passing over the 6th PolarSeries2 Point }
- Chart1.Canvas.Pen.Color:=clGreen;
- With PolarSeries2 do DrawRing( YValue[5], EndZ );
- end;
-
- procedure TPolarForm.CheckBox3Click(Sender: TObject);
- begin
- Chart1.View3D:=CheckBox3.Checked;
- end;
-
- end.
-