LazStats: Beginning to layout of CompareDistUnit to move report and chart inside the form.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7720 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-09-29 13:49:25 +00:00
parent feed93c12b
commit 98cf0d0621
3 changed files with 539 additions and 429 deletions

View File

@ -1,247 +1,164 @@
object CompareDistFrm: TCompareDistFrm inherited CompareDistFrm: TCompareDistFrm
Left = 462 Left = 671
Height = 375 Height = 413
Top = 227 Top = 327
Width = 516 Width = 924
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/ComparisonsWithTheoreticalDistri.htm' HelpKeyword = 'html/ComparisonsWithTheoreticalDistri.htm'
AutoSize = True
Caption = 'Compare Cumulative Distributions' Caption = 'Compare Cumulative Distributions'
ClientHeight = 375 ClientHeight = 413
ClientWidth = 516 ClientWidth = 924
OnActivate = FormActivate OnActivate = FormActivate
OnCreate = FormCreate OnCreate = FormCreate
OnShow = FormShow
Position = poMainFormCenter Position = poMainFormCenter
LCLVersion = '2.0.10.0' object ParamsPanel: TPanel[0]
object CompareGroup: TRadioGroup Left = 8
AnchorSideTop.Control = Owner Height = 397
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 326
Height = 72
Top = 8 Top = 8
Width = 182 Width = 288
Anchors = [akTop, akRight] Align = alLeft
AutoFill = True BorderSpacing.Left = 8
AutoSize = True
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 4
Caption = 'Compare To:' BorderSpacing.Bottom = 8
ChildSizing.LeftRightSpacing = 12 BevelOuter = bvNone
ChildSizing.TopBottomSpacing = 6 ClientHeight = 397
ChildSizing.VerticalSpacing = 2 ClientWidth = 288
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize TabOrder = 0
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 52
ClientWidth = 178
ItemIndex = 0
Items.Strings = (
'A Theoretical Distribution'
'Another Variable'
)
OnClick = CompareGroupClick
TabOrder = 2
end
object DistGroup: TRadioGroup
AnchorSideLeft.Control = CompareGroup
AnchorSideTop.Control = CompareGroup
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 326
Height = 135
Top = 96
Width = 182
Anchors = [akTop, akLeft, akRight]
AutoFill = True
AutoSize = True
BorderSpacing.Top = 16
BorderSpacing.Right = 8
Caption = 'Theoretical Distributions:'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 115
ClientWidth = 178
Items.Strings = (
'Normal Distribution'
't-Distribution'
'Chi Square Distribution'
'F Distribution'
'Poisson Distribution'
)
OnClick = DistGroupClick
TabOrder = 3
end
object ResetBtn: TButton object ResetBtn: TButton
AnchorSideRight.Control = ComputeBtn AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 299 Left = 87
Height = 25 Height = 25
Top = 342 Top = 372
Width = 54 Width = 54
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 12 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset' Caption = 'Reset'
OnClick = ResetBtnClick OnClick = ResetBtnClick
TabOrder = 5 TabOrder = 0
end end
object ComputeBtn: TButton object ComputeBtn: TButton
AnchorSideRight.Control = CloseBtn AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 365 Left = 149
Height = 25 Height = 25
Top = 342 Top = 372
Width = 76 Width = 76
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 12 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute' Caption = 'Compute'
OnClick = ComputeBtnClick OnClick = ComputeBtnClick
TabOrder = 6 TabOrder = 1
end end
object CloseBtn: TButton object CloseBtn: TButton
AnchorSideRight.Control = Owner AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 453 Left = 233
Height = 25 Height = 25
Top = 342 Top = 372
Width = 55 Width = 55
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Close' Caption = 'Close'
ModalResult = 11 ModalResult = 11
OnClick = CloseBtnClick OnClick = CloseBtnClick
TabOrder = 7 TabOrder = 2
end end
object PlotTypeGrp: TGroupBox object Bevel1: TBevel
AnchorSideLeft.Control = CompareGroup AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = DistGroup AnchorSideRight.Control = ParamsPanel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 326 AnchorSideBottom.Control = ResetBtn
Height = 74 Left = 0
Top = 247 Height = 8
Width = 182 Top = 356
Anchors = [akTop, akLeft, akRight] Width = 288
AutoSize = True Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Top = 16 Shape = bsBottomLine
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Plot Type:'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 54
ClientWidth = 178
TabOrder = 4
object PointsChk: TRadioButton
Left = 12
Height = 19
Top = 6
Width = 67
BorderSpacing.Left = 12
Caption = '3DPoints'
Checked = True
TabOrder = 0
TabStop = True
end end
object LinesChk: TRadioButton object OptionsGroup: TGroupBox
Left = 12 AnchorSideLeft.Control = ParamsPanel
Height = 19
Top = 27
Width = 67
BorderSpacing.Left = 12
BorderSpacing.Bottom = 8
Caption = '3DLines'
TabOrder = 1
end
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Bevel1 AnchorSideBottom.Control = Bevel1
Left = 8 Left = 0
Height = 47 Height = 83
Top = 279 Top = 273
Width = 298 Width = 302
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 8 BorderSpacing.Top = 8
Caption = 'Option:' Caption = 'Option:'
ClientHeight = 27 ClientHeight = 63
ClientWidth = 294 ClientWidth = 298
TabOrder = 1 TabOrder = 3
object BothChk: TCheckBox object BothChk: TCheckBox
Left = 12 AnchorSideLeft.Control = OptionsGroup
AnchorSideTop.Control = OptionsGroup
Left = 16
Height = 19 Height = 19
Top = 0 Top = 6
Width = 270 Width = 270
BorderSpacing.Left = 12 BorderSpacing.Left = 16
BorderSpacing.Top = 6
BorderSpacing.Right = 12 BorderSpacing.Right = 12
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Plot both Frequency and cumulative Frequency' Caption = 'Plot both Frequency and cumulative Frequency'
TabOrder = 0 TabOrder = 0
end end
end object VertBarBtn: TSpeedButton
object Bevel1: TBevel AnchorSideLeft.Control = OptionsGroup
AnchorSideLeft.Control = Owner AnchorSideTop.Control = BothChk
AnchorSideRight.Control = Owner AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom Left = 16
AnchorSideBottom.Control = ResetBtn Height = 22
Left = 0 Top = 33
Height = 8 Width = 23
Top = 326 BorderSpacing.Left = 16
Width = 516
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object Panel1: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = CompareGroup
AnchorSideBottom.Control = GroupBox1
Left = 8
Height = 263
Top = 8
Width = 310
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
BevelOuter = bvNone Images = MainDataModule.ImageList
ClientHeight = 263 ImageIndex = 8
ClientWidth = 310 end
TabOrder = 0 object LinePlotBtn: TSpeedButton
AnchorSideLeft.Control = VertBarBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = VertBarBtn
AnchorSideTop.Side = asrCenter
Left = 43
Height = 22
Top = 33
Width = 23
BorderSpacing.Left = 4
Images = MainDataModule.ImageList
ImageIndex = 10
end
object ThreeDChk: TCheckBox
AnchorSideLeft.Control = LinePlotBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = VertBarBtn
AnchorSideTop.Side = asrCenter
Left = 82
Height = 19
Top = 35
Width = 34
BorderSpacing.Left = 16
Caption = '3D'
TabOrder = 1
end
end
object Label1: TLabel object Label1: TLabel
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Panel1 AnchorSideTop.Control = ParamsPanel
Left = 0 Left = 0
Height = 15 Height = 15
Top = 0 Top = 0
@ -250,152 +167,258 @@ object CompareDistFrm: TCompareDistFrm
ParentColor = False ParentColor = False
end end
object VarList: TListBox object VarList: TListBox
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Label1 AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = VerticalCenterBevel AnchorSideRight.Control = Var1InBtn
AnchorSideBottom.Control = Panel1 AnchorSideBottom.Control = OptionsGroup
AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 246 Height = 248
Top = 17 Top = 17
Width = 150 Width = 99
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 6
BorderSpacing.Bottom = 8
ItemHeight = 0 ItemHeight = 0
OnDblClick = VarListDblClick
OnSelectionChange = VarListSelectionChange OnSelectionChange = VarListSelectionChange
TabOrder = 0 TabOrder = 4
end end
object Var1InBtn: TBitBtn object Var1InBtn: TBitBtn
AnchorSideLeft.Control = VerticalCenterBevel AnchorSideLeft.Control = CompareGroup
AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = VarList
AnchorSideBottom.Control = Var1OutBtn AnchorSideRight.Control = VarOneEdit
Left = 160 Left = 105
Height = 28 Height = 26
Top = 53 Top = 17
Width = 28 Width = 26
Anchors = [akLeft, akBottom] BorderSpacing.Right = 6
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 1 ImageIndex = 1
OnClick = Var1InBtnClick OnClick = Var1InBtnClick
Spacing = 0 Spacing = 0
TabOrder = 1 TabOrder = 5
end end
object Var1OutBtn: TBitBtn object Var1OutBtn: TBitBtn
AnchorSideLeft.Control = Var1InBtn AnchorSideLeft.Control = Var1InBtn
AnchorSideBottom.Control = VerticalCenterBevel AnchorSideTop.Control = Var1InBtn
Left = 160 AnchorSideTop.Side = asrBottom
Height = 28 Left = 105
Top = 85 Height = 26
Width = 28 Top = 47
Anchors = [akLeft, akBottom] Width = 26
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 0 ImageIndex = 0
OnClick = Var1OutBtnClick OnClick = Var1OutBtnClick
Spacing = 0 Spacing = 0
TabOrder = 2 TabOrder = 6
end
object Var2InBtn: TBitBtn
AnchorSideLeft.Control = VerticalCenterBevel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = VerticalCenterBevel
AnchorSideTop.Side = asrBottom
Left = 160
Height = 28
Top = 168
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = Var2InBtnClick
Spacing = 0
TabOrder = 3
end
object Var2OutBtn: TBitBtn
AnchorSideLeft.Control = Var2InBtn
AnchorSideTop.Control = Var2InBtn
AnchorSideTop.Side = asrBottom
Left = 160
Height = 28
Top = 200
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = Var2OutBtnClick
Spacing = 0
TabOrder = 4
end end
object Label2: TLabel object Label2: TLabel
AnchorSideLeft.Control = VarOneEdit AnchorSideLeft.Control = VarOneEdit
AnchorSideBottom.Control = VarOneEdit AnchorSideBottom.Control = VarOneEdit
Left = 196 Left = 139
Height = 15 Height = 15
Top = 61 Top = 21
Width = 66 Width = 66
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2 BorderSpacing.Bottom = 2
Caption = 'Variable One' Caption = 'Variable One'
ParentColor = False ParentColor = False
end end
object VarOneEdit: TEdit
AnchorSideLeft.Control = Var1InBtn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Var1OutBtn
AnchorSideBottom.Side = asrBottom
Left = 139
Height = 23
Top = 38
Width = 149
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 7
Text = 'VarOneEdit'
end
object CompareGroup: TRadioGroup
AnchorSideLeft.Control = Var1InBtn
AnchorSideTop.Control = Var1OutBtn
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
Left = 105
Height = 76
Top = 81
Width = 183
Anchors = [akTop, akRight]
AutoFill = True
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Bottom = 8
Caption = 'Compare To:'
ChildSizing.LeftRightSpacing = 18
ChildSizing.TopBottomSpacing = 8
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 56
ClientWidth = 179
ItemIndex = 0
Items.Strings = (
'Theoretical Distribution'
'Another Variable'
)
OnClick = CompareGroupClick
TabOrder = 8
end
object Notebook: TNotebook
AnchorSideLeft.Control = CompareGroup
AnchorSideTop.Control = CompareGroup
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CompareGroup
AnchorSideRight.Side = asrBottom
Left = 105
Height = 60
Top = 165
Width = 183
PageIndex = 1
AutoSize = True
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Bottom = 8
TabOrder = 9
object TheoreticalDistPage: TPage
object DistGroup: TRadioGroup
AnchorSideLeft.Control = TheoreticalDistPage
AnchorSideTop.Control = TheoreticalDistPage
AnchorSideRight.Control = TheoreticalDistPage
AnchorSideRight.Side = asrBottom
Left = 0
Height = 139
Top = 16
Width = 183
Anchors = [akTop, akLeft, akRight]
AutoFill = True
AutoSize = True
BorderSpacing.Top = 16
Caption = 'Theoretical Distributions:'
ChildSizing.LeftRightSpacing = 18
ChildSizing.TopBottomSpacing = 8
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 119
ClientWidth = 179
Items.Strings = (
'Normal Distribution'
't-Distribution'
'Chi-Sq Distribution'
'F Distribution'
'Poisson Distribution'
)
OnClick = DistGroupClick
TabOrder = 0
end
end
object VariablePage: TPage
object Var2InBtn: TBitBtn
AnchorSideLeft.Control = VariablePage
AnchorSideTop.Control = VariablePage
Left = 0
Height = 28
Top = 0
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = Var2InBtnClick
Spacing = 0
TabOrder = 0
end
object Var2OutBtn: TBitBtn
AnchorSideLeft.Control = VariablePage
AnchorSideTop.Control = Var2InBtn
AnchorSideTop.Side = asrBottom
Left = 0
Height = 28
Top = 32
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = Var2OutBtnClick
Spacing = 0
TabOrder = 1
end
object Label3: TLabel object Label3: TLabel
AnchorSideLeft.Control = VarTwoEdit AnchorSideLeft.Control = VarTwoEdit
AnchorSideBottom.Control = VarTwoEdit AnchorSideBottom.Control = VarTwoEdit
Left = 196 Left = 36
Height = 15 Height = 15
Top = 176 Top = 8
Width = 65 Width = 65
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2 BorderSpacing.Bottom = 2
Caption = 'Variable Two' Caption = 'Variable Two'
ParentColor = False ParentColor = False
end end
object VarOneEdit: TEdit
AnchorSideLeft.Control = Var1InBtn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Var1OutBtn
AnchorSideBottom.Side = asrBottom
Left = 196
Height = 23
Top = 78
Width = 114
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 5
Text = 'VarOneEdit'
end
object VarTwoEdit: TEdit object VarTwoEdit: TEdit
AnchorSideLeft.Control = Var2InBtn AnchorSideLeft.Control = Var2InBtn
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1 AnchorSideRight.Control = VariablePage
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Var2OutBtn AnchorSideBottom.Control = Var2OutBtn
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 196 Left = 36
Height = 23 Height = 23
Top = 193 Top = 25
Width = 114 Width = 147
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
ReadOnly = True ReadOnly = True
TabOrder = 6 TabOrder = 2
Text = 'Edit1' Text = 'Edit1'
end end
object VerticalCenterBevel: TBevel
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
AnchorSideTop.Side = asrCenter
Left = 150
Height = 55
Top = 113
Width = 10
Shape = bsSpacer
end end
end end
end
object PageControl1: TPageControl[1]
Left = 309
Height = 397
Top = 8
Width = 607
ActivePage = ReportPage
Align = alClient
BorderSpacing.Left = 4
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
TabIndex = 0
TabOrder = 1
object ReportPage: TTabSheet
Caption = 'Report'
end
object ChartPage: TTabSheet
Caption = 'Chart'
end
end
object ParamsSplitter: TSplitter[2]
Left = 300
Height = 413
Top = 0
Width = 5
ResizeStyle = rsPattern
end
end end

View File

@ -8,22 +8,29 @@ interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, StdCtrls, Buttons, ExtCtrls, ComCtrls,
OutputUnit, FunctionsLib, Globals, GraphLib, DataProcs, MainUnit; FunctionsLib, Globals, GraphLib, DataProcs, MainDM, MainUnit,
BasicStatsFormUnit, ReportFrameUnit, ChartFrameUnit;
type type
{ TCompareDistFrm } { TCompareDistFrm }
TCompareDistFrm = class(TForm) TCompareDistFrm = class(TBasicStatsForm)
Bevel1: TBevel; Bevel1: TBevel;
LinesChk: TRadioButton; PageControl1: TPageControl;
PointsChk: TRadioButton; ParamsSplitter: TSplitter;
VerticalCenterBevel: TBevel; ReportPage: TTabSheet;
ChartPage: TTabSheet;
ThreeDChk: TCheckBox;
Notebook: TNotebook;
VertBarBtn: TSpeedButton;
LinePlotBtn: TSpeedButton;
TheoreticalDistPage: TPage;
VariablePage: TPage;
ParamsPanel: TPanel;
BothChk: TCheckBox; BothChk: TCheckBox;
GroupBox1: TGroupBox; OptionsGroup: TGroupBox;
Panel1: TPanel;
PlotTypeGrp: TGroupBox;
ResetBtn: TButton; ResetBtn: TButton;
ComputeBtn: TButton; ComputeBtn: TButton;
CloseBtn: TButton; CloseBtn: TButton;
@ -45,88 +52,69 @@ type
procedure DistGroupClick(Sender: TObject); procedure DistGroupClick(Sender: TObject);
procedure FormActivate(Sender: TObject); procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ResetBtnClick(Sender: TObject); procedure ResetBtnClick(Sender: TObject);
procedure Var1InBtnClick(Sender: TObject); procedure Var1InBtnClick(Sender: TObject);
procedure Var1OutBtnClick(Sender: TObject); procedure Var1OutBtnClick(Sender: TObject);
procedure Var2InBtnClick(Sender: TObject); procedure Var2InBtnClick(Sender: TObject);
procedure Var2OutBtnClick(Sender: TObject); procedure Var2OutBtnClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; User: boolean); procedure VarListDblClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean);
private private
{ private declarations } FReportFrame: TReportFrame;
compareto: integer; FChartFrame: TChartFrame;
disttype: integer;
FAutoSized: Boolean; FAutoSized: Boolean;
CompareTo: integer;
DistType: integer;
procedure UpdateBtnStates; procedure UpdateBtnStates;
public public
{ public declarations } procedure Reset; override;
end; end;
var var
CompareDistFrm: TCompareDistFrm; CompareDistFrm: TCompareDistFrm;
implementation implementation
{$R *.lfm}
uses uses
Math, Math,
Utils, MathUnit; Utils, MathUnit;
{ TCompareDistFrm } { TCompareDistFrm }
procedure TCompareDistFrm.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;
Panel1.Constraints.MinWidth := Groupbox1.Width;
Panel1.Constraints.MinHeight := PlotTypeGrp.Top + PlotTypeGrp.Height - GroupBox1.Height - Panel1.BorderSpacing.Bottom - Panel1.Top;
Constraints.MinWidth := Width;
Constraints.MinHeight := Height;
FAutoSized := true;
end;
procedure TCompareDistFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
if GraphFrm = nil then Application.CreateForm(TGraphFrm, GraphFrm);
end;
procedure TCompareDistFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(nil);
end;
procedure TCompareDistFrm.CompareGroupClick(Sender: TObject);
begin
compareTo := CompareGroup.ItemIndex;
Label3.Enabled := (compareTo = 1);
VarTwoEdit.Enabled := (compareTo = 1);
Var2InBtn.Enabled := (compareTo = 1);
Var2OutBtn.Enabled := (compareTo = 1);
end;
procedure TCompareDistFrm.CloseBtnClick(Sender: TObject); procedure TCompareDistFrm.CloseBtnClick(Sender: TObject);
begin begin
Close; Close;
end; end;
procedure TCompareDistFrm.CompareGroupClick(Sender: TObject);
begin
compareTo := CompareGroup.ItemIndex;
Notebook.PageIndex := CompareGroup.ItemIndex;
{
Label3.Enabled := (compareTo = 1);
VarTwoEdit.Enabled := (compareTo = 1);
Var2InBtn.Enabled := (compareTo = 1);
Var2OutBtn.Enabled := (compareTo = 1);
}
end;
procedure TCompareDistFrm.ComputeBtnClick(Sender: TObject); procedure TCompareDistFrm.ComputeBtnClick(Sender: TObject);
var var
Var1Freq : IntDyneVec; Var1Freq : IntDyneVec = nil;
Var2Freq : IntDyneVec; Var2Freq : IntDyneVec = nil;
XValue1 : DblDyneVec; XValue1 : DblDyneVec = nil;
XValue2 : DblDyneVec; XValue2 : DblDyneVec = nil;
Cumfreq1 : DblDyneVec; Cumfreq1 : DblDyneVec = nil;
Cumfreq2 : DblDyneVec; Cumfreq2 : DblDyneVec = nil;
i, j, k, col1, col2, Ncases, noints : integer; i, j, k, col1, col2, Ncases, noints : integer;
min1, max1, min2, max2, range1, range2, value : double; min1, max1, min2, max2, range1, range2, value : double;
incrsize1, incrsize2, prob1,prob2, {%H-}KS, mean, DegFree : double; incrsize1, incrsize2, prob1,prob2, {%H-}KS, mean, DegFree : double;
@ -415,7 +403,7 @@ begin
KS := KolmogorovTest(noints, Cumfreq1,noints, Cumfreq2, cellval, lReport); KS := KolmogorovTest(noints, Cumfreq1,noints, Cumfreq2, cellval, lReport);
// lReport.Add('Kolmogorov-Smirnov statistic := %5.3f', [KS]); // lReport.Add('Kolmogorov-Smirnov statistic := %5.3f', [KS]);
DisplayReport(lReport); FReportFrame.DisplayReport(lReport);
finally finally
lReport.Free; lReport.Free;
end; end;
@ -423,11 +411,12 @@ begin
// plot the cdfs // plot the cdfs
xtitle := 'Red = ' + VarOneEdit.Text + ' Blue = ' + name2; xtitle := 'Red = ' + VarOneEdit.Text + ' Blue = ' + name2;
cellval := 'Plot of Cumulative Distributions'; cellval := 'Plot of Cumulative Distributions';
{
if LinesChk.Checked then if LinesChk.Checked then
GraphFrm.barwideprop := 1.0 GraphFrm.barwideprop := 1.0
else else
GraphFrm.barwideprop := 0.5; GraphFrm.barwideprop := 0.5;
}
GraphFrm.nosets := 2; GraphFrm.nosets := 2;
GraphFrm.nbars := noints+1; GraphFrm.nbars := noints+1;
GraphFrm.Heading := cellval; GraphFrm.Heading := cellval;
@ -442,10 +431,12 @@ begin
GraphFrm.Xpoints[0,k-1] := k; GraphFrm.Xpoints[0,k-1] := k;
end; end;
GraphFrm.AutoScaled := true; GraphFrm.AutoScaled := true;
{
if LinesChk.Checked then if LinesChk.Checked then
GraphFrm.GraphType := 6 // 3d lines GraphFrm.GraphType := 6 // 3d lines
else else
GraphFrm.GraphType := 8; // 3D points GraphFrm.GraphType := 8; // 3D points
}
GraphFrm.BackColor := clYellow; GraphFrm.BackColor := clYellow;
GraphFrm.WallColor := clBlue; GraphFrm.WallColor := clBlue;
GraphFrm.FloorColor := clGray; GraphFrm.FloorColor := clGray;
@ -461,10 +452,12 @@ begin
begin begin
xtitle := 'Red = ' + VarOneEdit.Text + ' Blue = ' + name2; xtitle := 'Red = ' + VarOneEdit.Text + ' Blue = ' + name2;
cellval := 'Plot of Cumulative Distributions'; cellval := 'Plot of Cumulative Distributions';
{
if LinesChk.Checked then if LinesChk.Checked then
GraphFrm.BarWideProp := 1.0 GraphFrm.BarWideProp := 1.0
else else
GraphFrm.BarWideProp := 0.5; GraphFrm.BarWideProp := 0.5;
}
GraphFrm.nosets := 2; GraphFrm.nosets := 2;
GraphFrm.nbars := noints+1; GraphFrm.nbars := noints+1;
GraphFrm.Heading := cellval; GraphFrm.Heading := cellval;
@ -479,10 +472,12 @@ begin
GraphFrm.Xpoints[0,k-1] := k; GraphFrm.Xpoints[0,k-1] := k;
end; end;
GraphFrm.AutoScaled := true; GraphFrm.AutoScaled := true;
{
if LinesChk.Checked then if LinesChk.Checked then
GraphFrm.GraphType := 6 // 3d lines GraphFrm.GraphType := 6 // 3d lines
else else
GraphFrm.GraphType := 8; // 3D points GraphFrm.GraphType := 8; // 3D points
}
GraphFrm.BackColor := clYellow; GraphFrm.BackColor := clYellow;
GraphFrm.WallColor := clBlue; GraphFrm.WallColor := clBlue;
GraphFrm.FloorColor := clGray; GraphFrm.FloorColor := clGray;
@ -504,12 +499,69 @@ begin
Var1Freq := nil; Var1Freq := nil;
end; end;
procedure TCompareDistFrm.DistGroupClick(Sender: TObject); procedure TCompareDistFrm.DistGroupClick(Sender: TObject);
begin begin
disttype := DistGroup.ItemIndex; DistType := DistGroup.ItemIndex;
end; end;
procedure TCompareDistFrm.ResetBtnClick(Sender: TObject);
procedure TCompareDistFrm.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;
Notebook.AutoSize := true;
ParamsPanel.Constraints.MinWidth := Max(
3*w + 2*CloseBtn.BorderSpacing.Left,
Min(
CompareGroup.Width * 2 - Var1InBtn.Width + VarList.BorderSpacing.Right,
OptionsGroup.Width)
);
ParamsPanel.Constraints.MinHeight := Notebook.Top + Notebook.Height +
OptionsGroup.BorderSpacing.Top + OptionsGroup.Height + Bevel1.Height +
CloseBtn.Height + CloseBtn.BorderSpacing.Top;
Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 300;
Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + ParamsPanel.BorderSpacing.Top * 2;
if Width < Constraints.MinWidth then Width := 1;
if Height < Constraints.MinHeight then Height := 1;
Notebook.AutoSize := false;
Position := poDesigned;
FAutoSized := true;
end;
procedure TCompareDistFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
if GraphFrm = nil then Application.CreateForm(TGraphFrm, GraphFrm);
InitForm(self);
FReportFrame := TReportFrame.Create(self);
FReportFrame.Parent := ReportPage;
FReportFrame.Align := alClient;
FChartFrame := TChartFrame.Create(self);
FChartFrame.Parent := ChartPage;
FChartFrame.Align := alClient;
FChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80;
FChartFrame.Chart.BottomAxis.Intervals.MinLength := 30;
Reset;
end;
procedure TCompareDistFrm.Reset;
var var
i: integer; i: integer;
begin begin
@ -518,13 +570,33 @@ begin
VarTwoEdit.Text := ''; VarTwoEdit.Text := '';
for i := 1 to NoVariables do for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
Label3.Enabled := false;
CompareGroup.ItemIndex := 0; CompareGroup.ItemIndex := 0;
CompareGroupClick(nil);
DistGroup.ItemIndex := 0; DistGroup.ItemIndex := 0;
LinesChk.Checked := false;
PointsChk.Checked := true; FReportFrame.Clear;
FChartFrame.Clear;
end; end;
procedure TCompareDistFrm.ResetBtnClick(Sender: TObject);
begin
Reset;
end;
procedure TCompareDistFrm.UpdateBtnStates;
begin
Var1InBtn.Enabled := (VarList.ItemIndex > -1) and (VarOneEdit.Text = '');
Var2InBtn.Enabled := (VarList.ItemIndex > -1) and (VarTwoEdit.Text = '');
Var1OutBtn.Enabled := VarOneEdit.Text <> '';
Var2OutBtn.Enabled := VarTwoEdit.Text <> '';
FReportFrame.UpdateBtnStates;
FChartFrame.UpdateBtnStates;
end;
procedure TCompareDistFrm.Var1InBtnClick(Sender: TObject); procedure TCompareDistFrm.Var1InBtnClick(Sender: TObject);
var var
i: integer; i: integer;
@ -543,6 +615,7 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TCompareDistFrm.Var1OutBtnClick(Sender: TObject); procedure TCompareDistFrm.Var1OutBtnClick(Sender: TObject);
begin begin
if VarOneEdit.Text <> '' then if VarOneEdit.Text <> '' then
@ -553,6 +626,7 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TCompareDistFrm.Var2InBtnClick(Sender: TObject); procedure TCompareDistFrm.Var2InBtnClick(Sender: TObject);
var var
i: integer; i: integer;
@ -571,6 +645,7 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TCompareDistFrm.Var2OutBtnClick(Sender: TObject); procedure TCompareDistFrm.Var2OutBtnClick(Sender: TObject);
begin begin
if VarTwoEdit.Text <> '' then if VarTwoEdit.Text <> '' then
@ -581,21 +656,34 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TCompareDistFrm.VarListDblClick(Sender: TObject);
var
index: Integer;
begin
index := VarList.ItemIndex;
if (index > -1) then
begin
if VarOneEdit.Text = '' then
begin
VarOneEdit.Text := VarList.Items[index];
VarList.Items.Delete(index);
end;
if CompareGroup.ItemIndex = 1 then // Compare to another variable
begin
VarTwoEdit.Text := VarList.Items[index];
VarList.Items.Delete(index);
end;
UpdateBtnStates;
end;
end;
procedure TCompareDistFrm.VarListSelectionChange(Sender: TObject; User: boolean); procedure TCompareDistFrm.VarListSelectionChange(Sender: TObject; User: boolean);
begin begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TCompareDistFrm.UpdateBtnStates;
begin
Var1InBtn.Enabled := (VarList.ItemIndex > -1) and (VarOneEdit.Text = '');
Var2InBtn.Enabled := (VarList.ItemIndex > -1) and (VarTwoEdit.Text = '');
Var1OutBtn.Enabled := VarOneEdit.Text <> '';
Var2OutBtn.Enabled := VarTwoEdit.Text <> '';
end;
initialization
{$I comparedistunit.lrs}
end. end.

View File

@ -1,20 +1,19 @@
object FreqFrm: TFreqFrm inherited FreqFrm: TFreqFrm
Left = 490 Left = 490
Height = 376 Height = 385
Top = 228 Top = 228
Width = 835 Width = 835
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/FrequencyAnalysis.htm' HelpKeyword = 'html/FrequencyAnalysis.htm'
Caption = 'Frequency Distribution' Caption = 'Frequency Distribution'
ClientHeight = 376 ClientHeight = 385
ClientWidth = 835 ClientWidth = 835
OnActivate = FormActivate OnActivate = FormActivate
OnCreate = FormCreate OnCreate = FormCreate
Position = poMainFormCenter Position = poMainFormCenter
LCLVersion = '2.1.0.0' object ParamsPanel: TPanel[0]
object ParamsPanel: TPanel
Left = 8 Left = 8
Height = 360 Height = 369
Top = 8 Top = 8
Width = 264 Width = 264
Align = alLeft Align = alLeft
@ -23,7 +22,7 @@ object FreqFrm: TFreqFrm
BorderSpacing.Right = 4 BorderSpacing.Right = 4
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 360 ClientHeight = 369
ClientWidth = 264 ClientWidth = 264
TabOrder = 0 TabOrder = 0
object Panel1: TPanel object Panel1: TPanel
@ -33,12 +32,12 @@ object FreqFrm: TFreqFrm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = NormPltChk AnchorSideBottom.Control = NormPltChk
Left = 0 Left = 0
Height = 163 Height = 172
Top = 0 Top = 0
Width = 264 Width = 264
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 163 ClientHeight = 172
ClientWidth = 264 ClientWidth = 264
TabOrder = 0 TabOrder = 0
object Label1: TLabel object Label1: TLabel
@ -69,7 +68,7 @@ object FreqFrm: TFreqFrm
AnchorSideBottom.Control = Panel1 AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 146 Height = 155
Top = 17 Top = 17
Width = 105 Width = 105
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -91,7 +90,7 @@ object FreqFrm: TFreqFrm
AnchorSideBottom.Control = Panel1 AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 159 Left = 159
Height = 146 Height = 155
Top = 17 Top = 17
Width = 105 Width = 105
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -151,7 +150,7 @@ object FreqFrm: TFreqFrm
AnchorSideBottom.Control = BinSelectionGroup AnchorSideBottom.Control = BinSelectionGroup
Left = 58 Left = 58
Height = 19 Height = 19
Top = 171 Top = 180
Width = 149 Width = 149
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Top = 8 BorderSpacing.Top = 8
@ -165,7 +164,7 @@ object FreqFrm: TFreqFrm
AnchorSideBottom.Control = CloseBtn AnchorSideBottom.Control = CloseBtn
Left = 0 Left = 0
Height = 8 Height = 8
Top = 319 Top = 328
Width = 264 Width = 264
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine Shape = bsBottomLine
@ -177,7 +176,7 @@ object FreqFrm: TFreqFrm
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 63 Left = 63
Height = 25 Height = 25
Top = 335 Top = 344
Width = 54 Width = 54
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
@ -194,7 +193,7 @@ object FreqFrm: TFreqFrm
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 209 Left = 209
Height = 25 Height = 25
Top = 335 Top = 344
Width = 55 Width = 55
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
@ -211,7 +210,7 @@ object FreqFrm: TFreqFrm
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 125 Left = 125
Height = 25 Height = 25
Top = 335 Top = 344
Width = 76 Width = 76
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
@ -230,7 +229,7 @@ object FreqFrm: TFreqFrm
AnchorSideBottom.Control = Bevel1 AnchorSideBottom.Control = Bevel1
Left = 0 Left = 0
Height = 52 Height = 52
Top = 267 Top = 276
Width = 255 Width = 255
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
AutoSize = True AutoSize = True
@ -318,7 +317,7 @@ object FreqFrm: TFreqFrm
AnchorSideBottom.Control = PlotOptionsGroup AnchorSideBottom.Control = PlotOptionsGroup
Left = 0 Left = 0
Height = 57 Height = 57
Top = 202 Top = 211
Width = 255 Width = 255
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
@ -373,16 +372,16 @@ object FreqFrm: TFreqFrm
end end
end end
end end
object ParamsSplitter: TSplitter object ParamsSplitter: TSplitter[1]
Left = 276 Left = 276
Height = 376 Height = 385
Top = 0 Top = 0
Width = 5 Width = 5
ResizeStyle = rsPattern ResizeStyle = rsPattern
end end
object PageControl: TPageControl object PageControl: TPageControl[2]
Left = 285 Left = 285
Height = 360 Height = 369
Top = 8 Top = 8
Width = 542 Width = 542
ActivePage = ReportPage ActivePage = ReportPage