You've already forked lazarus-ccr
LazStats: Inherit form of PlotXYUnit from TBasicStatsReportAndChartForm.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7740 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -8,82 +8,33 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
Caption = 'Plot X versus Y'
|
||||
ClientHeight = 500
|
||||
ClientWidth = 1000
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
Position = poMainFormCenter
|
||||
object ParamsPanel: TPanel[0]
|
||||
Left = 8
|
||||
inherited ParamsPanel: TPanel
|
||||
Height = 484
|
||||
Top = 8
|
||||
Width = 376
|
||||
Align = alLeft
|
||||
BorderSpacing.Around = 8
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 484
|
||||
ClientWidth = 376
|
||||
TabOrder = 0
|
||||
object CloseBtn: TButton
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ParamsPanel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 314
|
||||
Height = 25
|
||||
inherited CloseBtn: TButton
|
||||
Left = 321
|
||||
Top = 459
|
||||
Width = 62
|
||||
Anchors = [akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'Close'
|
||||
ModalResult = 11
|
||||
OnClick = CloseBtnClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object ComputeBtn: TButton
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
AnchorSideBottom.Control = ParamsPanel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 230
|
||||
Height = 25
|
||||
inherited ComputeBtn: TButton
|
||||
Left = 238
|
||||
Top = 459
|
||||
Width = 76
|
||||
Anchors = [akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Compute'
|
||||
OnClick = ComputeBtnClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object ResetBtn: TButton
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
AnchorSideBottom.Control = ParamsPanel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 25
|
||||
inherited ResetBtn: TButton
|
||||
Left = 176
|
||||
Top = 459
|
||||
Width = 54
|
||||
Anchors = [akRight, akBottom]
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Reset'
|
||||
OnClick = ResetBtnClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = CloseBtn
|
||||
Left = 0
|
||||
Height = 8
|
||||
inherited HelpBtn: TButton
|
||||
Left = 117
|
||||
Top = 459
|
||||
TabOrder = 11
|
||||
end
|
||||
inherited ButtonBevel: TBevel
|
||||
Top = 443
|
||||
Width = 376
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
object Label1: TLabel
|
||||
object Label1: TLabel[5]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideTop.Control = ParamsPanel
|
||||
Left = 0
|
||||
@ -93,12 +44,12 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
Caption = 'Variables'
|
||||
ParentColor = False
|
||||
end
|
||||
object VarList: TListBox
|
||||
object VarList: TListBox[6]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = XinBtn
|
||||
AnchorSideBottom.Control = Bevel1
|
||||
AnchorSideBottom.Control = ButtonBevel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 426
|
||||
@ -112,7 +63,7 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
OnSelectionChange = VarListSelectionChange
|
||||
TabOrder = 3
|
||||
end
|
||||
object Label2: TLabel
|
||||
object Label2: TLabel[7]
|
||||
AnchorSideLeft.Control = XEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = XEdit
|
||||
@ -125,7 +76,7 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
Caption = 'X Axis Variable'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label3: TLabel
|
||||
object Label3: TLabel[8]
|
||||
AnchorSideLeft.Control = YEdit
|
||||
AnchorSideBottom.Control = YEdit
|
||||
Left = 209
|
||||
@ -137,7 +88,7 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
Caption = 'Y Axis Variable'
|
||||
ParentColor = False
|
||||
end
|
||||
object XinBtn: TBitBtn
|
||||
object XinBtn: TBitBtn[9]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = VarList
|
||||
@ -153,7 +104,7 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
Spacing = 0
|
||||
TabOrder = 4
|
||||
end
|
||||
object XOutBtn: TBitBtn
|
||||
object XOutBtn: TBitBtn[10]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = XinBtn
|
||||
@ -169,7 +120,7 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
Spacing = 0
|
||||
TabOrder = 5
|
||||
end
|
||||
object YInBtn: TBitBtn
|
||||
object YInBtn: TBitBtn[11]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = XOutBtn
|
||||
@ -187,7 +138,7 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
Spacing = 0
|
||||
TabOrder = 6
|
||||
end
|
||||
object YOutBtn: TBitBtn
|
||||
object YOutBtn: TBitBtn[12]
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = YInBtn
|
||||
@ -205,7 +156,7 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
Spacing = 0
|
||||
TabOrder = 7
|
||||
end
|
||||
object XEdit: TEdit
|
||||
object XEdit: TEdit[13]
|
||||
AnchorSideLeft.Control = XinBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
@ -225,7 +176,7 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
TabOrder = 8
|
||||
Text = 'XEdit'
|
||||
end
|
||||
object YEdit: TEdit
|
||||
object YEdit: TEdit[14]
|
||||
AnchorSideLeft.Control = XEdit
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
@ -241,7 +192,7 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
TabOrder = 9
|
||||
Text = 'YEdit'
|
||||
end
|
||||
object OptionsGroup: TGroupBox
|
||||
object OptionsGroup: TGroupBox[15]
|
||||
AnchorSideLeft.Control = XinBtn
|
||||
AnchorSideTop.Control = YEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
@ -323,28 +274,13 @@ inherited PlotXYFrm: TPlotXYFrm
|
||||
end
|
||||
end
|
||||
end
|
||||
object ParamsSplitter: TSplitter[1]
|
||||
Left = 392
|
||||
inherited ParamsSplitter: TSplitter
|
||||
Left = 388
|
||||
Height = 500
|
||||
Top = 0
|
||||
Width = 5
|
||||
ResizeStyle = rsPattern
|
||||
end
|
||||
object PageControl1: TPageControl[2]
|
||||
Left = 405
|
||||
inherited PageControl: TPageControl
|
||||
Left = 397
|
||||
Height = 484
|
||||
Top = 8
|
||||
Width = 587
|
||||
ActivePage = ChartPage
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 8
|
||||
TabIndex = 1
|
||||
TabOrder = 2
|
||||
object ReportPage: TTabSheet
|
||||
Caption = 'Report'
|
||||
end
|
||||
object ChartPage: TTabSheet
|
||||
Caption = 'Chart'
|
||||
end
|
||||
Width = 595
|
||||
end
|
||||
end
|
||||
|
@ -9,29 +9,20 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, ExtCtrls, Buttons, ComCtrls,
|
||||
MainUnit, Globals, FunctionsLib, DataProcs, BasicStatsFormUnit,
|
||||
MainUnit, Globals, FunctionsLib, DataProcs, BasicStatsReportAndChartFormUnit,
|
||||
ReportFrameUnit, ChartFrameUnit;
|
||||
|
||||
type
|
||||
|
||||
{ TPlotXYFrm }
|
||||
|
||||
TPlotXYFrm = class(TBasicStatsForm)
|
||||
Bevel1: TBevel;
|
||||
TPlotXYFrm = class(TBasicStatsReportAndChartForm)
|
||||
ConfEdit: TEdit;
|
||||
Label4: TLabel;
|
||||
PageControl1: TPageControl;
|
||||
ParamsPanel: TPanel;
|
||||
ResetBtn: TButton;
|
||||
ComputeBtn: TButton;
|
||||
CloseBtn: TButton;
|
||||
LineChk: TCheckBox;
|
||||
MeansChk: TCheckBox;
|
||||
ConfChk: TCheckBox;
|
||||
OptionsGroup: TGroupBox;
|
||||
ParamsSplitter: TSplitter;
|
||||
ReportPage: TTabSheet;
|
||||
ChartPage: TTabSheet;
|
||||
YEdit: TEdit;
|
||||
Label3: TLabel;
|
||||
XEdit: TEdit;
|
||||
@ -42,11 +33,6 @@ type
|
||||
YOutBtn: TBitBtn;
|
||||
Label1: TLabel;
|
||||
VarList: TListBox;
|
||||
procedure CloseBtnClick(Sender: TObject);
|
||||
procedure ComputeBtnClick(Sender: TObject);
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure ResetBtnClick(Sender: TObject);
|
||||
procedure VarListDblClick(Sender: TObject);
|
||||
procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean);
|
||||
procedure XinBtnClick(Sender: TObject);
|
||||
@ -55,16 +41,17 @@ type
|
||||
procedure YOutBtnClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
FAutoSized: Boolean;
|
||||
FReportFrame: TReportFrame;
|
||||
FChartFrame: TChartFrame;
|
||||
procedure PlotXY(XPoints, YPoints, UpConf, LowConf: DblDyneVec;
|
||||
XMean, YMean, R, Slope, Intercept: Double);
|
||||
procedure UpdateBtnStates;
|
||||
protected
|
||||
procedure AdjustConstraints; override;
|
||||
procedure Compute; override;
|
||||
procedure UpdateBtnStates; override;
|
||||
function Validate(out AMsg: String; out AControl: TWinControl;
|
||||
Xcol,Ycol: Integer): Boolean;
|
||||
Xcol,Ycol: Integer): Boolean; reintroduce;
|
||||
public
|
||||
{ public declarations }
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure Reset; override;
|
||||
end;
|
||||
|
||||
@ -82,6 +69,30 @@ uses
|
||||
|
||||
{ TPlotXYFrm }
|
||||
|
||||
constructor TPlotXYFrm.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
FChartFrame.Chart.Legend.Alignment := laBottomCenter;
|
||||
FChartFrame.Chart.Legend.ColumnCount := 3;
|
||||
FChartFrame.Chart.Legend.TextFormat := tfHTML;
|
||||
with FChartFrame.Chart.AxisList.Add do
|
||||
begin
|
||||
Alignment := calRight;
|
||||
Marks.Source := TListChartSource.Create(self);
|
||||
Marks.Style := smsLabel;
|
||||
Grid.Visible := false;
|
||||
end;
|
||||
with FChartFrame.Chart.AxisList.Add do
|
||||
begin
|
||||
Alignment := calTop;
|
||||
Marks.Source := TListChartSource.Create(self);
|
||||
Marks.Style := smsLabel;
|
||||
Grid.Visible := false;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TPlotXYfrm.Reset;
|
||||
var
|
||||
i: integer;
|
||||
@ -95,18 +106,16 @@ begin
|
||||
VarList.Items.Clear;
|
||||
for i := 1 to NoVariables do
|
||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||
|
||||
if Assigned(FChartFrame) then
|
||||
FChartFrame.Clear;
|
||||
if Assigned(FReportFrame) then
|
||||
FReportFrame.Clear;
|
||||
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TPlotXYFrm.ResetBtnClick(Sender: TObject);
|
||||
begin
|
||||
Reset;
|
||||
end;
|
||||
|
||||
|
||||
procedure TPlotXYFrm.VarListDblClick(Sender: TObject);
|
||||
var
|
||||
index: integer;
|
||||
@ -170,7 +179,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPlotXYFrm.ComputeBtnClick(Sender: TObject);
|
||||
procedure TPlotXYFrm.Compute;
|
||||
var
|
||||
Xmin, Xmax, Ymin, Ymax, SSx, SSY, t, DF: double;
|
||||
Xmean, Ymean, Xvariance, Yvariance, Xstddev, Ystddev, ConfBand: double;
|
||||
@ -341,73 +350,15 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TPlotXYFrm.CloseBtnClick(Sender: TObject);
|
||||
procedure TPlotXYFrm.AdjustConstraints;
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
|
||||
procedure TPlotXYFrm.FormActivate(Sender: TObject);
|
||||
var
|
||||
w: Integer;
|
||||
begin
|
||||
if FAutoSized then
|
||||
exit;
|
||||
|
||||
w := MaxValue([ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
|
||||
ResetBtn.Constraints.MinWidth := w;
|
||||
ComputeBtn.Constraints.MinWidth := w;
|
||||
CloseBtn.Constraints.MinWidth := w;
|
||||
|
||||
ParamsPanel.Constraints.MinHeight := OptionsGroup.Top + OptionsGroup.Height +
|
||||
OptionsGroup.BorderSpacing.Bottom + Bevel1.Height +
|
||||
OptionsGroup.BorderSpacing.Bottom + ButtonBevel.Height +
|
||||
CloseBtn.Height + CloseBtn.BorderSpacing.Top;
|
||||
ParamsPanel.Constraints.MinWidth := OptionsGroup.Width * 2 - XInBtn.Width div 2 - XInBtn.BorderSpacing.Left;
|
||||
|
||||
Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + ParamsPanel.BorderSpacing.Around*2;
|
||||
Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 200;
|
||||
if Height < Constraints.MinHeight then Height := 1;
|
||||
if Width < Constraints.MinWidth then Width := 1;
|
||||
|
||||
Position := poDesigned;
|
||||
FAutoSized := True;
|
||||
end;
|
||||
|
||||
|
||||
procedure TPlotXYFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Assert(OS3MainFrm <> nil);
|
||||
|
||||
InitForm(self);
|
||||
|
||||
FReportFrame := TReportFrame.Create(self);
|
||||
FReportFrame.Parent := ReportPage;
|
||||
FReportFrame.Align := alClient;
|
||||
|
||||
FChartFrame := TChartFrame.Create(self);
|
||||
FChartFrame.Parent := ChartPage;
|
||||
FChartFrame.Align := alClient;
|
||||
FChartFrame.Chart.Legend.Alignment := laBottomCenter;
|
||||
FChartFrame.Chart.Legend.ColumnCount := 3;
|
||||
FChartFrame.Chart.Legend.TextFormat := tfHTML;
|
||||
FChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80;
|
||||
FChartFrame.Chart.BottomAxis.Intervals.MinLength := 30;
|
||||
with FChartFrame.Chart.AxisList.Add do
|
||||
begin
|
||||
Alignment := calRight;
|
||||
Marks.Source := TListChartSource.Create(self);
|
||||
Marks.Style := smsLabel;
|
||||
Grid.Visible := false;
|
||||
end;
|
||||
with FChartFrame.Chart.AxisList.Add do
|
||||
begin
|
||||
Alignment := calTop;
|
||||
Marks.Source := TListChartSource.Create(self);
|
||||
Marks.Style := smsLabel;
|
||||
Grid.Visible := false;
|
||||
end;
|
||||
|
||||
Reset;
|
||||
end;
|
||||
|
||||
|
||||
@ -486,7 +437,9 @@ begin
|
||||
YinBtn.Enabled := (VarList.ItemIndex > -1) and (YEdit.Text = '');
|
||||
YoutBtn.Enabled := (YEdit.Text <> '');
|
||||
|
||||
if Assigned(FReportFrame) then
|
||||
FReportFrame.UpdateBtnStates;
|
||||
if Assigned(FChartFrame) then
|
||||
FChartFrame.UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
@ -21,6 +21,7 @@ type
|
||||
protected
|
||||
FReportFrame: TReportFrame;
|
||||
FChartFrame: TChartFrame;
|
||||
procedure InitForm; override;
|
||||
procedure UpdateBtnStates; override;
|
||||
|
||||
public
|
||||
|
Reference in New Issue
Block a user