home *** CD-ROM | disk | FTP | other *** search
- {**********************************************}
- { TErrorSeries Component Example }
- { Copyright (c) 1995-1998 by David Berneda }
- {**********************************************}
- unit uerrstd;
-
- interface
-
- uses
- WinProcs,WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- TeEngine, Series, ErrorBar, TeeProcs, Chart, TeeComma, StdCtrls, Buttons,
- ExtCtrls;
-
- type
- TErrStdForm = class(TForm)
- Panel1: TPanel;
- Label1: TLabel;
- CheckBox1: TCheckBox;
- BitBtn3: TBitBtn;
- Memo1: TMemo;
- TeeCommander1: TTeeCommander;
- Chart1: TChart;
- Series1: TErrorSeries;
- Series2: TErrorSeries;
- Series3: TErrorSeries;
- Series4: TErrorSeries;
- CheckBox2: TCheckBox;
- procedure FormCreate(Sender: TObject);
- procedure CheckBox2Click(Sender: TObject);
- procedure BitBtn3Click(Sender: TObject);
- procedure Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- private
- { Private declarations }
- Function CheckSeries(ASeries:TChartSeries; x,y:Integer):Boolean;
- public
- { Public declarations }
- end;
-
- var
- ErrStdForm: TErrStdForm;
-
- implementation
-
- {$R *.DFM}
-
- procedure TErrStdForm.FormCreate(Sender: TObject);
- begin
- Series1.FillSampleValues(15);
- Series2.FillSampleValues(15);
- Randomize;
- Series3.FillSampleValues(15);
- Series4.FillSampleValues(15);
- end;
-
- procedure TErrStdForm.CheckBox2Click(Sender: TObject);
- var tmp:Integer;
- begin
- { Change the Error Pen width }
- if CheckBox2.Checked then tmp:=2
- else tmp:=1;
- Series1.ErrorPen.Width:=tmp;
- Series2.ErrorPen.Width:=tmp;
- Series3.ErrorPen.Width:=tmp;
- Series4.ErrorPen.Width:=tmp;
- end;
-
- procedure TErrStdForm.BitBtn3Click(Sender: TObject);
- begin
- Close;
- end;
-
- Function TErrStdForm.CheckSeries(ASeries:TChartSeries; x,y:Integer):Boolean;
- var tmp:Integer;
- begin
- tmp:=ASeries.Clicked(x,y);
- if tmp<>-1 then
- begin
- Label1.Caption:=IntToStr(tmp);
- Label1.Font.Color:=ASeries.ValueColor[tmp];
- result:=True;
- end
- else result:=False;
- end;
-
- procedure TErrStdForm.Chart1MouseMove(Sender: TObject; Shift: TShiftState;
- X, Y: Integer);
- begin
- if (not CheckSeries(Series1,x,y)) and
- (not CheckSeries(Series2,x,y)) and
- (not CheckSeries(Series3,x,y)) and
- (not CheckSeries(Series4,x,y)) then
- Label1.Caption:='';
- end;
-
- end.
-