diff --git a/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.lfm index ea0e517d2..55e68a191 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.lfm @@ -1,247 +1,164 @@ -object CompareDistFrm: TCompareDistFrm - Left = 462 - Height = 375 - Top = 227 - Width = 516 +inherited CompareDistFrm: TCompareDistFrm + Left = 671 + Height = 413 + Top = 327 + Width = 924 HelpType = htKeyword HelpKeyword = 'html/ComparisonsWithTheoreticalDistri.htm' - AutoSize = True Caption = 'Compare Cumulative Distributions' - ClientHeight = 375 - ClientWidth = 516 + ClientHeight = 413 + ClientWidth = 924 OnActivate = FormActivate OnCreate = FormCreate - OnShow = FormShow Position = poMainFormCenter - LCLVersion = '2.0.10.0' - object CompareGroup: TRadioGroup - AnchorSideTop.Control = Owner - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 326 - Height = 72 - Top = 8 - Width = 182 - Anchors = [akTop, akRight] - AutoFill = True - AutoSize = True - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - Caption = 'Compare To:' - 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 = 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 - AnchorSideRight.Control = ComputeBtn - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 299 - Height = 25 - Top = 342 - Width = 54 - Anchors = [akRight, akBottom] - AutoSize = True - BorderSpacing.Top = 8 - BorderSpacing.Right = 12 - BorderSpacing.Bottom = 8 - Caption = 'Reset' - OnClick = ResetBtnClick - TabOrder = 5 - end - object ComputeBtn: TButton - AnchorSideRight.Control = CloseBtn - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 365 - Height = 25 - Top = 342 - Width = 76 - Anchors = [akRight, akBottom] - AutoSize = True - BorderSpacing.Top = 8 - BorderSpacing.Right = 12 - BorderSpacing.Bottom = 8 - Caption = 'Compute' - OnClick = ComputeBtnClick - TabOrder = 6 - end - object CloseBtn: TButton - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 453 - Height = 25 - Top = 342 - Width = 55 - Anchors = [akRight, akBottom] - AutoSize = True - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - Caption = 'Close' - ModalResult = 11 - OnClick = CloseBtnClick - TabOrder = 7 - end - object PlotTypeGrp: TGroupBox - AnchorSideLeft.Control = CompareGroup - AnchorSideTop.Control = DistGroup - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 326 - Height = 74 - Top = 247 - Width = 182 - Anchors = [akTop, akLeft, akRight] - AutoSize = True - BorderSpacing.Top = 16 - 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 - object LinesChk: TRadioButton - Left = 12 - 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 + object ParamsPanel: TPanel[0] Left = 8 - Height = 47 - Top = 279 - Width = 298 - Anchors = [akLeft, akBottom] - AutoSize = True - BorderSpacing.Left = 8 - Caption = 'Option:' - ClientHeight = 27 - ClientWidth = 294 - TabOrder = 1 - object BothChk: TCheckBox - Left = 12 - Height = 19 - Top = 0 - Width = 270 - BorderSpacing.Left = 12 - BorderSpacing.Right = 12 - BorderSpacing.Bottom = 8 - Caption = 'Plot both Frequency and cumulative Frequency' - TabOrder = 0 - end - end - object Bevel1: TBevel - AnchorSideLeft.Control = Owner - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = ResetBtn - Left = 0 - Height = 8 - Top = 326 - 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 + Height = 397 Top = 8 - Width = 310 - Anchors = [akTop, akLeft, akRight, akBottom] + Width = 288 + Align = alLeft BorderSpacing.Left = 8 BorderSpacing.Top = 8 - BorderSpacing.Right = 8 + BorderSpacing.Right = 4 BorderSpacing.Bottom = 8 BevelOuter = bvNone - ClientHeight = 263 - ClientWidth = 310 + ClientHeight = 397 + ClientWidth = 288 TabOrder = 0 + object ResetBtn: TButton + AnchorSideRight.Control = ComputeBtn + AnchorSideBottom.Control = ParamsPanel + AnchorSideBottom.Side = asrBottom + Left = 87 + Height = 25 + Top = 372 + Width = 54 + Anchors = [akRight, akBottom] + AutoSize = True + BorderSpacing.Top = 8 + BorderSpacing.Right = 8 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 0 + end + object ComputeBtn: TButton + AnchorSideRight.Control = CloseBtn + AnchorSideBottom.Control = ParamsPanel + AnchorSideBottom.Side = asrBottom + Left = 149 + Height = 25 + Top = 372 + Width = 76 + Anchors = [akRight, akBottom] + AutoSize = True + BorderSpacing.Left = 8 + BorderSpacing.Top = 8 + BorderSpacing.Right = 8 + Caption = 'Compute' + OnClick = ComputeBtnClick + TabOrder = 1 + end + object CloseBtn: TButton + AnchorSideRight.Control = ParamsPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = ParamsPanel + AnchorSideBottom.Side = asrBottom + Left = 233 + Height = 25 + Top = 372 + Width = 55 + Anchors = [akRight, akBottom] + AutoSize = True + BorderSpacing.Left = 8 + BorderSpacing.Top = 8 + Caption = 'Close' + ModalResult = 11 + OnClick = CloseBtnClick + TabOrder = 2 + end + object Bevel1: TBevel + AnchorSideLeft.Control = ParamsPanel + AnchorSideRight.Control = ParamsPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = ResetBtn + Left = 0 + Height = 8 + Top = 356 + Width = 288 + Anchors = [akLeft, akRight, akBottom] + Shape = bsBottomLine + end + object OptionsGroup: TGroupBox + AnchorSideLeft.Control = ParamsPanel + AnchorSideBottom.Control = Bevel1 + Left = 0 + Height = 83 + Top = 273 + Width = 302 + Anchors = [akLeft, akBottom] + AutoSize = True + BorderSpacing.Top = 8 + Caption = 'Option:' + ClientHeight = 63 + ClientWidth = 298 + TabOrder = 3 + object BothChk: TCheckBox + AnchorSideLeft.Control = OptionsGroup + AnchorSideTop.Control = OptionsGroup + Left = 16 + Height = 19 + Top = 6 + Width = 270 + BorderSpacing.Left = 16 + BorderSpacing.Top = 6 + BorderSpacing.Right = 12 + BorderSpacing.Bottom = 8 + Caption = 'Plot both Frequency and cumulative Frequency' + TabOrder = 0 + end + object VertBarBtn: TSpeedButton + AnchorSideLeft.Control = OptionsGroup + AnchorSideTop.Control = BothChk + AnchorSideTop.Side = asrBottom + Left = 16 + Height = 22 + Top = 33 + Width = 23 + BorderSpacing.Left = 16 + BorderSpacing.Bottom = 8 + Images = MainDataModule.ImageList + ImageIndex = 8 + end + 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 - AnchorSideLeft.Control = Panel1 - AnchorSideTop.Control = Panel1 + AnchorSideLeft.Control = ParamsPanel + AnchorSideTop.Control = ParamsPanel Left = 0 Height = 15 Top = 0 @@ -250,152 +167,258 @@ object CompareDistFrm: TCompareDistFrm ParentColor = False end object VarList: TListBox - AnchorSideLeft.Control = Panel1 + AnchorSideLeft.Control = ParamsPanel AnchorSideTop.Control = Label1 AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = VerticalCenterBevel - AnchorSideBottom.Control = Panel1 - AnchorSideBottom.Side = asrBottom + AnchorSideRight.Control = Var1InBtn + AnchorSideBottom.Control = OptionsGroup Left = 0 - Height = 246 + Height = 248 Top = 17 - Width = 150 + Width = 99 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Top = 2 + BorderSpacing.Right = 6 + BorderSpacing.Bottom = 8 ItemHeight = 0 + OnDblClick = VarListDblClick OnSelectionChange = VarListSelectionChange - TabOrder = 0 + TabOrder = 4 end object Var1InBtn: TBitBtn - AnchorSideLeft.Control = VerticalCenterBevel - AnchorSideLeft.Side = asrBottom - AnchorSideBottom.Control = Var1OutBtn - Left = 160 - Height = 28 - Top = 53 - Width = 28 - Anchors = [akLeft, akBottom] + AnchorSideLeft.Control = CompareGroup + AnchorSideTop.Control = VarList + AnchorSideRight.Control = VarOneEdit + Left = 105 + Height = 26 + Top = 17 + Width = 26 + BorderSpacing.Right = 6 BorderSpacing.Bottom = 4 Images = MainDataModule.ImageList ImageIndex = 1 OnClick = Var1InBtnClick Spacing = 0 - TabOrder = 1 + TabOrder = 5 end object Var1OutBtn: TBitBtn AnchorSideLeft.Control = Var1InBtn - AnchorSideBottom.Control = VerticalCenterBevel - Left = 160 - Height = 28 - Top = 85 - Width = 28 - Anchors = [akLeft, akBottom] + AnchorSideTop.Control = Var1InBtn + AnchorSideTop.Side = asrBottom + Left = 105 + Height = 26 + Top = 47 + Width = 26 Images = MainDataModule.ImageList ImageIndex = 0 OnClick = Var1OutBtnClick Spacing = 0 - TabOrder = 2 - 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 + TabOrder = 6 end object Label2: TLabel AnchorSideLeft.Control = VarOneEdit AnchorSideBottom.Control = VarOneEdit - Left = 196 + Left = 139 Height = 15 - Top = 61 + Top = 21 Width = 66 Anchors = [akLeft, akBottom] BorderSpacing.Bottom = 2 Caption = 'Variable One' ParentColor = False end - object Label3: TLabel - AnchorSideLeft.Control = VarTwoEdit - AnchorSideBottom.Control = VarTwoEdit - Left = 196 - Height = 15 - Top = 176 - Width = 65 - Anchors = [akLeft, akBottom] - BorderSpacing.Bottom = 2 - Caption = 'Variable Two' - ParentColor = False - end object VarOneEdit: TEdit AnchorSideLeft.Control = Var1InBtn AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = Panel1 + AnchorSideRight.Control = ParamsPanel AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = Var1OutBtn AnchorSideBottom.Side = asrBottom - Left = 196 + Left = 139 Height = 23 - Top = 78 - Width = 114 + Top = 38 + Width = 149 Anchors = [akLeft, akRight, akBottom] BorderSpacing.Left = 8 BorderSpacing.Bottom = 12 ReadOnly = True - TabOrder = 5 + TabOrder = 7 Text = 'VarOneEdit' end - object VarTwoEdit: TEdit - AnchorSideLeft.Control = Var2InBtn - AnchorSideLeft.Side = asrBottom - AnchorSideRight.Control = Panel1 + object CompareGroup: TRadioGroup + AnchorSideLeft.Control = Var1InBtn + AnchorSideTop.Control = Var1OutBtn + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = ParamsPanel AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = Var2OutBtn - AnchorSideBottom.Side = asrBottom - Left = 196 - Height = 23 - Top = 193 - Width = 114 - Anchors = [akLeft, akRight, akBottom] - BorderSpacing.Left = 8 - BorderSpacing.Bottom = 12 - ReadOnly = True - TabOrder = 6 - Text = 'Edit1' + 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 VerticalCenterBevel: TBevel - AnchorSideLeft.Control = Panel1 - AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = VarList - AnchorSideTop.Side = asrCenter - Left = 150 - Height = 55 - Top = 113 - Width = 10 - Shape = bsSpacer + 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 + AnchorSideLeft.Control = VarTwoEdit + AnchorSideBottom.Control = VarTwoEdit + Left = 36 + Height = 15 + Top = 8 + Width = 65 + Anchors = [akLeft, akBottom] + BorderSpacing.Bottom = 2 + Caption = 'Variable Two' + ParentColor = False + end + object VarTwoEdit: TEdit + AnchorSideLeft.Control = Var2InBtn + AnchorSideLeft.Side = asrBottom + AnchorSideRight.Control = VariablePage + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = Var2OutBtn + AnchorSideBottom.Side = asrBottom + Left = 36 + Height = 23 + Top = 25 + Width = 147 + Anchors = [akLeft, akRight, akBottom] + BorderSpacing.Left = 8 + BorderSpacing.Bottom = 12 + ReadOnly = True + TabOrder = 2 + Text = 'Edit1' + 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 diff --git a/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.pas b/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.pas index 7c6298812..2c3ed8f4f 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/comparedistunit.pas @@ -8,22 +8,29 @@ interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, - StdCtrls, Buttons, ExtCtrls, - OutputUnit, FunctionsLib, Globals, GraphLib, DataProcs, MainUnit; + StdCtrls, Buttons, ExtCtrls, ComCtrls, + FunctionsLib, Globals, GraphLib, DataProcs, MainDM, MainUnit, + BasicStatsFormUnit, ReportFrameUnit, ChartFrameUnit; type { TCompareDistFrm } - TCompareDistFrm = class(TForm) + TCompareDistFrm = class(TBasicStatsForm) Bevel1: TBevel; - LinesChk: TRadioButton; - PointsChk: TRadioButton; - VerticalCenterBevel: TBevel; + PageControl1: TPageControl; + ParamsSplitter: TSplitter; + ReportPage: TTabSheet; + ChartPage: TTabSheet; + ThreeDChk: TCheckBox; + Notebook: TNotebook; + VertBarBtn: TSpeedButton; + LinePlotBtn: TSpeedButton; + TheoreticalDistPage: TPage; + VariablePage: TPage; + ParamsPanel: TPanel; BothChk: TCheckBox; - GroupBox1: TGroupBox; - Panel1: TPanel; - PlotTypeGrp: TGroupBox; + OptionsGroup: TGroupBox; ResetBtn: TButton; ComputeBtn: TButton; CloseBtn: TButton; @@ -45,88 +52,69 @@ type procedure DistGroupClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); - procedure FormShow(Sender: TObject); procedure ResetBtnClick(Sender: TObject); procedure Var1InBtnClick(Sender: TObject); procedure Var1OutBtnClick(Sender: TObject); procedure Var2InBtnClick(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 declarations } - compareto: integer; - disttype: integer; + FReportFrame: TReportFrame; + FChartFrame: TChartFrame; FAutoSized: Boolean; + CompareTo: integer; + DistType: integer; procedure UpdateBtnStates; + public - { public declarations } + procedure Reset; override; end; + var CompareDistFrm: TCompareDistFrm; + implementation +{$R *.lfm} + uses Math, Utils, MathUnit; + { 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); begin Close; 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); var - Var1Freq : IntDyneVec; - Var2Freq : IntDyneVec; - XValue1 : DblDyneVec; - XValue2 : DblDyneVec; - Cumfreq1 : DblDyneVec; - Cumfreq2 : DblDyneVec; + Var1Freq : IntDyneVec = nil; + Var2Freq : IntDyneVec = nil; + XValue1 : DblDyneVec = nil; + XValue2 : DblDyneVec = nil; + Cumfreq1 : DblDyneVec = nil; + Cumfreq2 : DblDyneVec = nil; i, j, k, col1, col2, Ncases, noints : integer; min1, max1, min2, max2, range1, range2, value : double; incrsize1, incrsize2, prob1,prob2, {%H-}KS, mean, DegFree : double; @@ -415,7 +403,7 @@ begin KS := KolmogorovTest(noints, Cumfreq1,noints, Cumfreq2, cellval, lReport); // lReport.Add('Kolmogorov-Smirnov statistic := %5.3f', [KS]); - DisplayReport(lReport); + FReportFrame.DisplayReport(lReport); finally lReport.Free; end; @@ -423,11 +411,12 @@ begin // plot the cdfs xtitle := 'Red = ' + VarOneEdit.Text + ' Blue = ' + name2; cellval := 'Plot of Cumulative Distributions'; + { if LinesChk.Checked then GraphFrm.barwideprop := 1.0 else GraphFrm.barwideprop := 0.5; - + } GraphFrm.nosets := 2; GraphFrm.nbars := noints+1; GraphFrm.Heading := cellval; @@ -442,10 +431,12 @@ begin GraphFrm.Xpoints[0,k-1] := k; end; GraphFrm.AutoScaled := true; + { if LinesChk.Checked then GraphFrm.GraphType := 6 // 3d lines else GraphFrm.GraphType := 8; // 3D points + } GraphFrm.BackColor := clYellow; GraphFrm.WallColor := clBlue; GraphFrm.FloorColor := clGray; @@ -461,10 +452,12 @@ begin begin xtitle := 'Red = ' + VarOneEdit.Text + ' Blue = ' + name2; cellval := 'Plot of Cumulative Distributions'; + { if LinesChk.Checked then GraphFrm.BarWideProp := 1.0 else GraphFrm.BarWideProp := 0.5; + } GraphFrm.nosets := 2; GraphFrm.nbars := noints+1; GraphFrm.Heading := cellval; @@ -479,10 +472,12 @@ begin GraphFrm.Xpoints[0,k-1] := k; end; GraphFrm.AutoScaled := true; + { if LinesChk.Checked then GraphFrm.GraphType := 6 // 3d lines else GraphFrm.GraphType := 8; // 3D points + } GraphFrm.BackColor := clYellow; GraphFrm.WallColor := clBlue; GraphFrm.FloorColor := clGray; @@ -504,12 +499,69 @@ begin Var1Freq := nil; end; + procedure TCompareDistFrm.DistGroupClick(Sender: TObject); begin - disttype := DistGroup.ItemIndex; + DistType := DistGroup.ItemIndex; 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 i: integer; begin @@ -518,13 +570,33 @@ begin VarTwoEdit.Text := ''; for i := 1 to NoVariables do VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); - Label3.Enabled := false; CompareGroup.ItemIndex := 0; + CompareGroupClick(nil); DistGroup.ItemIndex := 0; - LinesChk.Checked := false; - PointsChk.Checked := true; + + FReportFrame.Clear; + FChartFrame.Clear; 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); var i: integer; @@ -543,6 +615,7 @@ begin UpdateBtnStates; end; + procedure TCompareDistFrm.Var1OutBtnClick(Sender: TObject); begin if VarOneEdit.Text <> '' then @@ -553,6 +626,7 @@ begin UpdateBtnStates; end; + procedure TCompareDistFrm.Var2InBtnClick(Sender: TObject); var i: integer; @@ -571,6 +645,7 @@ begin UpdateBtnStates; end; + procedure TCompareDistFrm.Var2OutBtnClick(Sender: TObject); begin if VarTwoEdit.Text <> '' then @@ -581,21 +656,34 @@ begin UpdateBtnStates; 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); begin UpdateBtnStates; 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. diff --git a/applications/lazstats/source/forms/analysis/descriptive/frequnit.lfm b/applications/lazstats/source/forms/analysis/descriptive/frequnit.lfm index 28f5dc866..89ac9a961 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/frequnit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/frequnit.lfm @@ -1,20 +1,19 @@ -object FreqFrm: TFreqFrm +inherited FreqFrm: TFreqFrm Left = 490 - Height = 376 + Height = 385 Top = 228 Width = 835 HelpType = htKeyword HelpKeyword = 'html/FrequencyAnalysis.htm' Caption = 'Frequency Distribution' - ClientHeight = 376 + ClientHeight = 385 ClientWidth = 835 OnActivate = FormActivate OnCreate = FormCreate Position = poMainFormCenter - LCLVersion = '2.1.0.0' - object ParamsPanel: TPanel + object ParamsPanel: TPanel[0] Left = 8 - Height = 360 + Height = 369 Top = 8 Width = 264 Align = alLeft @@ -23,7 +22,7 @@ object FreqFrm: TFreqFrm BorderSpacing.Right = 4 BorderSpacing.Bottom = 8 BevelOuter = bvNone - ClientHeight = 360 + ClientHeight = 369 ClientWidth = 264 TabOrder = 0 object Panel1: TPanel @@ -33,12 +32,12 @@ object FreqFrm: TFreqFrm AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = NormPltChk Left = 0 - Height = 163 + Height = 172 Top = 0 Width = 264 Anchors = [akTop, akLeft, akRight, akBottom] BevelOuter = bvNone - ClientHeight = 163 + ClientHeight = 172 ClientWidth = 264 TabOrder = 0 object Label1: TLabel @@ -69,7 +68,7 @@ object FreqFrm: TFreqFrm AnchorSideBottom.Control = Panel1 AnchorSideBottom.Side = asrBottom Left = 0 - Height = 146 + Height = 155 Top = 17 Width = 105 Anchors = [akTop, akLeft, akRight, akBottom] @@ -91,7 +90,7 @@ object FreqFrm: TFreqFrm AnchorSideBottom.Control = Panel1 AnchorSideBottom.Side = asrBottom Left = 159 - Height = 146 + Height = 155 Top = 17 Width = 105 Anchors = [akTop, akLeft, akRight, akBottom] @@ -151,7 +150,7 @@ object FreqFrm: TFreqFrm AnchorSideBottom.Control = BinSelectionGroup Left = 58 Height = 19 - Top = 171 + Top = 180 Width = 149 Anchors = [akLeft, akBottom] BorderSpacing.Top = 8 @@ -165,7 +164,7 @@ object FreqFrm: TFreqFrm AnchorSideBottom.Control = CloseBtn Left = 0 Height = 8 - Top = 319 + Top = 328 Width = 264 Anchors = [akLeft, akRight, akBottom] Shape = bsBottomLine @@ -177,7 +176,7 @@ object FreqFrm: TFreqFrm AnchorSideBottom.Side = asrBottom Left = 63 Height = 25 - Top = 335 + Top = 344 Width = 54 Anchors = [akRight, akBottom] AutoSize = True @@ -194,7 +193,7 @@ object FreqFrm: TFreqFrm AnchorSideBottom.Side = asrBottom Left = 209 Height = 25 - Top = 335 + Top = 344 Width = 55 Anchors = [akRight, akBottom] AutoSize = True @@ -211,7 +210,7 @@ object FreqFrm: TFreqFrm AnchorSideBottom.Side = asrBottom Left = 125 Height = 25 - Top = 335 + Top = 344 Width = 76 Anchors = [akRight, akBottom] AutoSize = True @@ -230,7 +229,7 @@ object FreqFrm: TFreqFrm AnchorSideBottom.Control = Bevel1 Left = 0 Height = 52 - Top = 267 + Top = 276 Width = 255 Anchors = [akLeft, akRight, akBottom] AutoSize = True @@ -318,7 +317,7 @@ object FreqFrm: TFreqFrm AnchorSideBottom.Control = PlotOptionsGroup Left = 0 Height = 57 - Top = 202 + Top = 211 Width = 255 Anchors = [akLeft, akBottom] AutoSize = True @@ -373,16 +372,16 @@ object FreqFrm: TFreqFrm end end end - object ParamsSplitter: TSplitter + object ParamsSplitter: TSplitter[1] Left = 276 - Height = 376 + Height = 385 Top = 0 Width = 5 ResizeStyle = rsPattern end - object PageControl: TPageControl + object PageControl: TPageControl[2] Left = 285 - Height = 360 + Height = 369 Top = 8 Width = 542 ActivePage = ReportPage