You've already forked lazarus-ccr
LazStats: Inherit form of NormalityUnit from TBasicStatsReportAndChartForm.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7744 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -8,98 +8,42 @@ inherited NormalityFrm: TNormalityFrm
|
|||||||
Caption = 'Normality Tests'
|
Caption = 'Normality Tests'
|
||||||
ClientHeight = 516
|
ClientHeight = 516
|
||||||
ClientWidth = 998
|
ClientWidth = 998
|
||||||
OnActivate = FormActivate
|
inherited ParamsPanel: TPanel
|
||||||
OnCreate = FormCreate
|
|
||||||
Position = poMainFormCenter
|
|
||||||
object ParamsPanel: TPanel[0]
|
|
||||||
Left = 8
|
|
||||||
Height = 500
|
Height = 500
|
||||||
Top = 8
|
|
||||||
Width = 320
|
|
||||||
Align = alLeft
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 4
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
BevelOuter = bvNone
|
|
||||||
ClientHeight = 500
|
ClientHeight = 500
|
||||||
ClientWidth = 320
|
inherited CloseBtn: TButton
|
||||||
TabOrder = 0
|
Top = 475
|
||||||
object Panel1: TPanel
|
TabOrder = 5
|
||||||
|
end
|
||||||
|
inherited ComputeBtn: TButton
|
||||||
|
Top = 475
|
||||||
|
TabOrder = 6
|
||||||
|
end
|
||||||
|
inherited ResetBtn: TButton
|
||||||
|
Top = 475
|
||||||
|
TabOrder = 7
|
||||||
|
end
|
||||||
|
inherited HelpBtn: TButton
|
||||||
|
Top = 475
|
||||||
|
TabOrder = 8
|
||||||
|
end
|
||||||
|
inherited ButtonBevel: TBevel
|
||||||
|
Top = 459
|
||||||
|
end
|
||||||
|
object Panel1: TPanel[5]
|
||||||
AnchorSideRight.Control = ParamsPanel
|
AnchorSideRight.Control = ParamsPanel
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 26
|
Height = 0
|
||||||
Top = 474
|
Top = 500
|
||||||
Width = 320
|
Width = 291
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 26
|
|
||||||
ClientWidth = 320
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object CloseBtn: TButton
|
|
||||||
AnchorSideTop.Control = Panel1
|
|
||||||
AnchorSideTop.Side = asrCenter
|
|
||||||
AnchorSideRight.Control = Panel1
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 265
|
|
||||||
Height = 25
|
|
||||||
Top = 1
|
|
||||||
Width = 55
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
Caption = 'Close'
|
|
||||||
ModalResult = 11
|
|
||||||
OnClick = CloseBtnClick
|
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object ComputeBtn: TButton
|
|
||||||
AnchorSideTop.Control = Panel1
|
|
||||||
AnchorSideTop.Side = asrCenter
|
|
||||||
AnchorSideRight.Control = CloseBtn
|
|
||||||
Left = 181
|
|
||||||
Height = 25
|
|
||||||
Top = 1
|
|
||||||
Width = 76
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
Caption = 'Compute'
|
|
||||||
OnClick = ComputeBtnClick
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
object ResetBtn: TButton
|
|
||||||
AnchorSideTop.Control = Panel1
|
|
||||||
AnchorSideTop.Side = asrCenter
|
|
||||||
AnchorSideRight.Control = ComputeBtn
|
|
||||||
Left = 119
|
|
||||||
Height = 25
|
|
||||||
Top = 1
|
|
||||||
Width = 54
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
Caption = 'Reset'
|
|
||||||
OnClick = ResetBtnClick
|
|
||||||
TabOrder = 2
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
object Bevel1: TBevel
|
object Label1: TLabel[6]
|
||||||
AnchorSideLeft.Control = ParamsPanel
|
|
||||||
AnchorSideRight.Control = ParamsPanel
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = Panel1
|
|
||||||
Left = 0
|
|
||||||
Height = 8
|
|
||||||
Top = 460
|
|
||||||
Width = 320
|
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
|
||||||
Shape = bsBottomLine
|
|
||||||
end
|
|
||||||
object Label1: TLabel
|
|
||||||
AnchorSideLeft.Control = ParamsPanel
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideTop.Control = ParamsPanel
|
AnchorSideTop.Control = ParamsPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -109,16 +53,16 @@ inherited NormalityFrm: TNormalityFrm
|
|||||||
Caption = 'Variables:'
|
Caption = 'Variables:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object VarList: TListBox
|
object VarList: TListBox[7]
|
||||||
AnchorSideLeft.Control = ParamsPanel
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideTop.Control = Label1
|
AnchorSideTop.Control = Label1
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = VarInBtn
|
AnchorSideRight.Control = VarInBtn
|
||||||
AnchorSideBottom.Control = Bevel1
|
AnchorSideBottom.Control = ButtonBevel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 443
|
Height = 442
|
||||||
Top = 17
|
Top = 17
|
||||||
Width = 140
|
Width = 125
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Top = 2
|
BorderSpacing.Top = 2
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
@ -127,13 +71,13 @@ inherited NormalityFrm: TNormalityFrm
|
|||||||
OnSelectionChange = VarListSelectionChange
|
OnSelectionChange = VarListSelectionChange
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object VarInBtn: TBitBtn
|
object VarInBtn: TBitBtn[8]
|
||||||
AnchorSideLeft.Control = ParamsPanel
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideLeft.Side = asrCenter
|
AnchorSideLeft.Side = asrCenter
|
||||||
AnchorSideTop.Control = VarList
|
AnchorSideTop.Control = VarList
|
||||||
AnchorSideRight.Control = VarList
|
AnchorSideRight.Control = VarList
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 146
|
Left = 131
|
||||||
Height = 28
|
Height = 28
|
||||||
Top = 17
|
Top = 17
|
||||||
Width = 28
|
Width = 28
|
||||||
@ -143,12 +87,12 @@ inherited NormalityFrm: TNormalityFrm
|
|||||||
Spacing = 0
|
Spacing = 0
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object VarOutBtn: TBitBtn
|
object VarOutBtn: TBitBtn[9]
|
||||||
AnchorSideLeft.Control = ParamsPanel
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideLeft.Side = asrCenter
|
AnchorSideLeft.Side = asrCenter
|
||||||
AnchorSideTop.Control = VarInBtn
|
AnchorSideTop.Control = VarInBtn
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 146
|
Left = 131
|
||||||
Height = 28
|
Height = 28
|
||||||
Top = 49
|
Top = 49
|
||||||
Width = 28
|
Width = 28
|
||||||
@ -160,28 +104,28 @@ inherited NormalityFrm: TNormalityFrm
|
|||||||
Spacing = 0
|
Spacing = 0
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
end
|
end
|
||||||
object TestVarEdit: TEdit
|
object TestVarEdit: TEdit[10]
|
||||||
AnchorSideLeft.Control = VarOutBtn
|
AnchorSideLeft.Control = VarOutBtn
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = Label2
|
AnchorSideTop.Control = Label2
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = ParamsPanel
|
AnchorSideRight.Control = ParamsPanel
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 180
|
Left = 165
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 45
|
Top = 45
|
||||||
Width = 140
|
Width = 126
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 2
|
BorderSpacing.Top = 2
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
Text = 'TestVarEdit'
|
Text = 'TestVarEdit'
|
||||||
end
|
end
|
||||||
object Label2: TLabel
|
object Label2: TLabel[11]
|
||||||
AnchorSideLeft.Control = TestVarEdit
|
AnchorSideLeft.Control = TestVarEdit
|
||||||
AnchorSideBottom.Control = VarInBtn
|
AnchorSideBottom.Control = VarInBtn
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 180
|
Left = 165
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 28
|
Top = 28
|
||||||
Width = 93
|
Width = 93
|
||||||
@ -191,31 +135,11 @@ inherited NormalityFrm: TNormalityFrm
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object ParamsSplitter: TSplitter[1]
|
inherited ParamsSplitter: TSplitter
|
||||||
Left = 332
|
|
||||||
Height = 516
|
Height = 516
|
||||||
Top = 0
|
|
||||||
Width = 5
|
|
||||||
ResizeStyle = rsPattern
|
|
||||||
end
|
end
|
||||||
object PageControl: TPageControl[2]
|
inherited PageControl: TPageControl
|
||||||
Left = 341
|
|
||||||
Height = 500
|
Height = 500
|
||||||
Top = 8
|
Width = 678
|
||||||
Width = 649
|
|
||||||
ActivePage = ChartPage
|
|
||||||
Align = alClient
|
|
||||||
BorderSpacing.Left = 4
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
TabIndex = 1
|
|
||||||
TabOrder = 2
|
|
||||||
object ReportPage: TTabSheet
|
|
||||||
Caption = 'Report'
|
|
||||||
end
|
|
||||||
object ChartPage: TTabSheet
|
|
||||||
Caption = 'Chart'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||||
StdCtrls, Buttons, ExtCtrls, ComCtrls,
|
StdCtrls, Buttons, ExtCtrls, ComCtrls,
|
||||||
MainUnit, Globals, FunctionsLib, DataProcs, BasicStatsFormUnit,
|
MainUnit, Globals, FunctionsLib, DataProcs, BasicStatsReportAndChartFormUnit,
|
||||||
ReportFrameUnit, ChartFrameUnit;
|
ReportFrameUnit, ChartFrameUnit;
|
||||||
|
|
||||||
|
|
||||||
@ -17,46 +17,33 @@ type
|
|||||||
|
|
||||||
{ TNormalityFrm }
|
{ TNormalityFrm }
|
||||||
|
|
||||||
TNormalityFrm = class(TBasicStatsForm)
|
TNormalityFrm = class(TBasicStatsReportAndChartForm)
|
||||||
Bevel1: TBevel;
|
|
||||||
PageControl: TPageControl;
|
|
||||||
ParamsPanel: TPanel;
|
|
||||||
ResetBtn: TButton;
|
|
||||||
ComputeBtn: TButton;
|
|
||||||
CloseBtn: TButton;
|
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
ParamsSplitter: TSplitter;
|
|
||||||
ReportPage: TTabSheet;
|
|
||||||
ChartPage: TTabSheet;
|
|
||||||
TestVarEdit: TEdit;
|
TestVarEdit: TEdit;
|
||||||
Label2: TLabel;
|
Label2: TLabel;
|
||||||
VarInBtn: TBitBtn;
|
VarInBtn: TBitBtn;
|
||||||
VarOutBtn: TBitBtn;
|
VarOutBtn: TBitBtn;
|
||||||
Label1: TLabel;
|
Label1: TLabel;
|
||||||
VarList: TListBox;
|
VarList: TListBox;
|
||||||
procedure CloseBtnClick(Sender: TObject);
|
|
||||||
procedure ComputeBtnClick(Sender: TObject);
|
|
||||||
procedure FormActivate(Sender: TObject);
|
|
||||||
procedure FormCreate(Sender: TObject);
|
|
||||||
procedure ResetBtnClick(Sender: TObject);
|
|
||||||
procedure VarInBtnClick(Sender: TObject);
|
procedure VarInBtnClick(Sender: TObject);
|
||||||
procedure VarListDblClick(Sender: TObject);
|
procedure VarListDblClick(Sender: TObject);
|
||||||
procedure VarListSelectionChange(Sender: TObject; User: boolean);
|
procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean);
|
||||||
procedure VarOutBtnClick(Sender: TObject);
|
procedure VarOutBtnClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
FReportFrame: TReportFrame;
|
function Calc_ShapiroWilks(const AData: DblDyneVec; var W, Prob: Double): Boolean;
|
||||||
FChartFrame: TChartFrame;
|
|
||||||
FAutoSized: boolean;
|
|
||||||
function Calc_ShapiroWilks(const AData: DblDyneVec; out W, Prob: Double): Boolean;
|
|
||||||
procedure Calc_Lilliefors(const AData: DblDyneVec;
|
procedure Calc_Lilliefors(const AData: DblDyneVec;
|
||||||
out ASkew, AKurtosis, AStat: Double; out AConclusion: String);
|
out ASkew, AKurtosis, AStat: Double; out AConclusion: String);
|
||||||
procedure PlotData(AData: DblDyneVec);
|
procedure PlotData(AData: DblDyneVec);
|
||||||
function PrepareData(const VarName: String): DblDyneVec;
|
function PrepareData(const VarName: String): DblDyneVec;
|
||||||
procedure UpdateBtnStates;
|
|
||||||
|
|
||||||
|
protected
|
||||||
|
procedure AdjustConstraints; override;
|
||||||
|
procedure Compute; override;
|
||||||
|
procedure UpdateBtnStates; override;
|
||||||
|
|
||||||
public
|
public
|
||||||
{ public declarations }
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure Reset; override;
|
procedure Reset; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -70,7 +57,7 @@ implementation
|
|||||||
uses
|
uses
|
||||||
Math, MathUnit,
|
Math, MathUnit,
|
||||||
TAChartUtils, TATextElements, TACustomSeries, TATransformations,
|
TAChartUtils, TATextElements, TACustomSeries, TATransformations,
|
||||||
TAChartAxisUtils, TAChartAxis, TACustomSource, TASources,
|
TAChartAxisUtils, TAChartAxis, TASources,
|
||||||
Utils;
|
Utils;
|
||||||
|
|
||||||
|
|
||||||
@ -89,9 +76,6 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
function PopulateRightMarks(AOwner: TComponent): TListChartSource;
|
function PopulateRightMarks(AOwner: TComponent): TListChartSource;
|
||||||
const
|
|
||||||
SIGMA = 1;
|
|
||||||
MEAN = 0;
|
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
z: Double;
|
z: Double;
|
||||||
@ -99,13 +83,13 @@ begin
|
|||||||
Result := TListChartSource.Create(AOwner);
|
Result := TListChartSource.Create(AOwner);
|
||||||
for i := -6 to -1 do
|
for i := -6 to -1 do
|
||||||
begin
|
begin
|
||||||
z := NormalDist(i); //*SIGMA, MEAN, SIGMA);
|
z := NormalDist(i);
|
||||||
Result.Add(z, z, 'μ -' + IntToStr(-i) + ' σ');
|
Result.Add(z, z, 'μ -' + IntToStr(-i) + ' σ');
|
||||||
end;
|
end;
|
||||||
Result.Add(0.5, 0.5, 'Mean (μ)');
|
Result.Add(0.5, 0.5, 'Mean (μ)');
|
||||||
for i := 1 to 6 do
|
for i := 1 to 6 do
|
||||||
begin
|
begin
|
||||||
z := NormalDist(i); //*SIGMA, MEAN, SIGMA);
|
z := NormalDist(i);
|
||||||
Result.Add(z, z, 'μ + ' + IntToStr(i) + ' σ');
|
Result.Add(z, z, 'μ + ' + IntToStr(i) + ' σ');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -113,6 +97,55 @@ end;
|
|||||||
|
|
||||||
{ TNormalityFrm }
|
{ TNormalityFrm }
|
||||||
|
|
||||||
|
constructor TNormalityFrm.Create(AOwner: TComponent);
|
||||||
|
var
|
||||||
|
T : TChartAxisTransformations;
|
||||||
|
InvNormDistTransform: TAxisTransform;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
T := TChartAxisTransformations.Create(FChartFrame);
|
||||||
|
InvNormDistTransform := TCumulNormDistrAxisTransform.Create(T);
|
||||||
|
InvNormDistTransform.Transformations := T;
|
||||||
|
|
||||||
|
with FChartFrame.Chart.LeftAxis do
|
||||||
|
begin
|
||||||
|
Transformations := T;
|
||||||
|
|
||||||
|
Marks.Source := PopulateLeftMarks(FChartFrame.Chart);
|
||||||
|
Marks.Style := smsValue;
|
||||||
|
Marks.OverlapPolicy := opHideNeighbour;
|
||||||
|
end;
|
||||||
|
|
||||||
|
with TChartAxis(FChartFrame.Chart.AxisList.Add) do
|
||||||
|
begin
|
||||||
|
Alignment := calRight;
|
||||||
|
Transformations := T;
|
||||||
|
Marks.Source := PopulateRightMarks(FChartFrame.Chart);
|
||||||
|
Marks.Style := smsLabel;
|
||||||
|
Marks.TextFormat := tfHTML;
|
||||||
|
Grid.Color := clSilver;
|
||||||
|
Grid.Style := psSolid;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TNormalityFrm.AdjustConstraints;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
ParamsPanel.Constraints.MinWidth := Max(
|
||||||
|
3*CloseBtn.Width + 2*CloseBtn.BorderSpacing.Left,
|
||||||
|
Max(Label1.Width, Label2.Width) + VarInBtn.Width + 2*VarList.BorderSpacing.Right);
|
||||||
|
ParamsPanel.Constraints.MinHeight := VarOutBtn.Top + VarOutBtn.Height +
|
||||||
|
VarOutBtn.BorderSpacing.Bottom + ButtonBevel.Height + Panel1.Height +
|
||||||
|
Panel1.BorderSpacing.Top;
|
||||||
|
|
||||||
|
Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 300;
|
||||||
|
Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + 2*ParamsPanel.BorderSpacing.Top;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TNormalityFrm.Calc_Lilliefors(const AData: DblDyneVec;
|
procedure TNormalityFrm.Calc_Lilliefors(const AData: DblDyneVec;
|
||||||
out ASkew, AKurtosis, AStat: Double; out AConclusion: String);
|
out ASkew, AKurtosis, AStat: Double; out AConclusion: String);
|
||||||
var
|
var
|
||||||
@ -228,7 +261,7 @@ end;
|
|||||||
|
|
||||||
{ Call Shapiro-Wilks function }
|
{ Call Shapiro-Wilks function }
|
||||||
function TNormalityFrm.Calc_ShapiroWilks(const AData: DblDyneVec;
|
function TNormalityFrm.Calc_ShapiroWilks(const AData: DblDyneVec;
|
||||||
out W, Prob: Double): boolean;
|
var W, Prob: Double): boolean;
|
||||||
var
|
var
|
||||||
init: Boolean = false;
|
init: Boolean = false;
|
||||||
n, n1, n2: Integer;
|
n, n1, n2: Integer;
|
||||||
@ -256,88 +289,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TNormalityFrm.CloseBtnClick(Sender: TObject);
|
procedure TNormalityFrm.Compute;
|
||||||
begin
|
|
||||||
Close;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure TNormalityFrm.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.MinWidth := Max(
|
|
||||||
3*w + 2*CloseBtn.BorderSpacing.Left,
|
|
||||||
Max(Label1.Width, Label2.Width) + VarInBtn.Width + 2*VarList.BorderSpacing.Right);
|
|
||||||
ParamsPanel.Constraints.MinHeight := VarOutBtn.Top + VarOutBtn.Height +
|
|
||||||
VarOutBtn.BorderSpacing.Bottom + Bevel1.Height + Panel1.Height +
|
|
||||||
Panel1.BorderSpacing.Top;
|
|
||||||
|
|
||||||
Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 300;
|
|
||||||
Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + 2*ParamsPanel.BorderSpacing.Top;
|
|
||||||
|
|
||||||
Position := poDesigned;
|
|
||||||
FAutoSized := True;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TNormalityFrm.FormCreate(Sender: TObject);
|
|
||||||
var
|
|
||||||
T : TChartAxisTransformations;
|
|
||||||
InvNormDistTransform: TAxisTransform;
|
|
||||||
L: TListChartSource;
|
|
||||||
i: Integer;
|
|
||||||
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.BottomAxis.Intervals.MaxLength := 80;
|
|
||||||
FChartFrame.Chart.BottomAxis.Intervals.MinLength := 30;
|
|
||||||
|
|
||||||
T := TChartAxisTransformations.Create(FChartFrame);
|
|
||||||
InvNormDistTransform := TCumulNormDistrAxisTransform.Create(T);
|
|
||||||
InvNormDistTransform.Transformations := T;
|
|
||||||
|
|
||||||
with FChartFrame.Chart.LeftAxis do
|
|
||||||
begin
|
|
||||||
Transformations := T;
|
|
||||||
|
|
||||||
Marks.Source := PopulateLeftMarks(FChartFrame.Chart);
|
|
||||||
Marks.Style := smsValue;
|
|
||||||
Marks.OverlapPolicy := opHideNeighbour;
|
|
||||||
end;
|
|
||||||
|
|
||||||
with TChartAxis(FChartFrame.Chart.AxisList.Add) do
|
|
||||||
begin
|
|
||||||
Alignment := calRight;
|
|
||||||
Transformations := T;
|
|
||||||
Marks.Source := PopulateRightMarks(FChartFrame.Chart);
|
|
||||||
Marks.Style := smsLabel;
|
|
||||||
Marks.TextFormat := tfHTML;
|
|
||||||
Grid.Color := clSilver;
|
|
||||||
Grid.Style := psSolid;
|
|
||||||
end;
|
|
||||||
|
|
||||||
Reset;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure TNormalityFrm.ComputeBtnClick(Sender: TObject);
|
|
||||||
var
|
var
|
||||||
w: Double = 0.0;
|
w: Double = 0.0;
|
||||||
pw: Double = 0.0;
|
pw: Double = 0.0;
|
||||||
@ -347,6 +299,8 @@ var
|
|||||||
conclusion: String;
|
conclusion: String;
|
||||||
lReport: TStrings;
|
lReport: TStrings;
|
||||||
begin
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
data := PrepareData(TestVarEdit.Text);
|
data := PrepareData(TestVarEdit.Text);
|
||||||
if data = nil then
|
if data = nil then
|
||||||
exit;
|
exit;
|
||||||
@ -468,24 +422,23 @@ begin
|
|||||||
VarList.Items.Clear;
|
VarList.Items.Clear;
|
||||||
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]);
|
||||||
FReportFrame.Clear;
|
|
||||||
FChartFrame.Clear;
|
if Assigned(FReportFrame) then
|
||||||
|
FReportFrame.Clear;
|
||||||
|
if Assigned(FChartFrame) then
|
||||||
|
FChartFrame.Clear;
|
||||||
UpdateBtnStates;
|
UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TNormalityFrm.ResetBtnClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
Reset;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure TNormalityFrm.UpdateBtnStates;
|
procedure TNormalityFrm.UpdateBtnStates;
|
||||||
begin
|
begin
|
||||||
VarInBtn.Enabled := (VarList.ItemIndex > -1) and (TestVarEdit.Text = '');
|
VarInBtn.Enabled := (VarList.ItemIndex > -1) and (TestVarEdit.Text = '');
|
||||||
VarOutBtn.Enabled := (TestVarEdit.Text <> '');
|
VarOutBtn.Enabled := (TestVarEdit.Text <> '');
|
||||||
FReportFrame.UpdateBtnStates;
|
if Assigned(FReportFrame) then
|
||||||
FChartFrame.UpdateBtnStates;
|
FReportFrame.UpdateBtnStates;
|
||||||
|
if Assigned(FChartFrame) then
|
||||||
|
FChartFrame.UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user