LazStats: Inherit form of CompareDistUnit from TBasicStatsReportAndChartFormUnit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7753 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-10-07 21:01:01 +00:00
parent 167189ab8c
commit 1fda53b1eb
2 changed files with 92 additions and 254 deletions

View File

@ -8,89 +8,32 @@ inherited CompareDistFrm: TCompareDistFrm
Caption = 'Compare Cumulative Distributions' Caption = 'Compare Cumulative Distributions'
ClientHeight = 535 ClientHeight = 535
ClientWidth = 924 ClientWidth = 924
OnActivate = FormActivate inherited ParamsPanel: TPanel
OnCreate = FormCreate
Position = poMainFormCenter
object ParamsPanel: TPanel[0]
Left = 8
Height = 519 Height = 519
Top = 8
Width = 296
Align = alLeft
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 4
BorderSpacing.Bottom = 8
BevelOuter = bvNone
ClientHeight = 519 ClientHeight = 519
ClientWidth = 296 inherited CloseBtn: TButton
TabOrder = 0
object ResetBtn: TButton
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom
Left = 95
Height = 25
Top = 494 Top = 494
Width = 54 TabOrder = 10
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 7
end end
object ComputeBtn: TButton inherited ComputeBtn: TButton
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom
Left = 157
Height = 25
Top = 494 Top = 494
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 8
end
object CloseBtn: TButton
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom
Left = 241
Height = 25
Top = 494
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Close'
ModalResult = 11
OnClick = CloseBtnClick
TabOrder = 9 TabOrder = 9
end end
object Bevel1: TBevel inherited ResetBtn: TButton
AnchorSideLeft.Control = ParamsPanel Top = 494
AnchorSideRight.Control = ParamsPanel TabOrder = 8
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ResetBtn
Left = 0
Height = 8
Top = 478
Width = 296
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end end
object OptionsGroup: TGroupBox inherited HelpBtn: TButton
Top = 494
TabOrder = 7
Visible = False
end
inherited ButtonBevel: TBevel
Top = 478
end
object OptionsGroup: TGroupBox[5]
AnchorSideLeft.Control = ParamsPanel AnchorSideLeft.Control = ParamsPanel
AnchorSideBottom.Control = Bevel1 AnchorSideBottom.Control = ButtonBevel
Left = 0 Left = 0
Height = 110 Height = 110
Top = 368 Top = 368
@ -178,7 +121,7 @@ inherited CompareDistFrm: TCompareDistFrm
ParentColor = False ParentColor = False
end end
end end
object Label1: TLabel object Label1: TLabel[6]
AnchorSideLeft.Control = ParamsPanel AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = ParamsPanel AnchorSideTop.Control = ParamsPanel
Left = 0 Left = 0
@ -188,7 +131,7 @@ inherited CompareDistFrm: TCompareDistFrm
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
@ -197,7 +140,7 @@ inherited CompareDistFrm: TCompareDistFrm
Left = 0 Left = 0
Height = 343 Height = 343
Top = 17 Top = 17
Width = 107 Width = 102
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 6 BorderSpacing.Right = 6
@ -207,11 +150,11 @@ inherited CompareDistFrm: TCompareDistFrm
OnSelectionChange = VarListSelectionChange OnSelectionChange = VarListSelectionChange
TabOrder = 0 TabOrder = 0
end end
object Var1InBtn: TBitBtn object Var1InBtn: TBitBtn[8]
AnchorSideLeft.Control = CompareGroup AnchorSideLeft.Control = CompareGroup
AnchorSideTop.Control = VarList AnchorSideTop.Control = VarList
AnchorSideRight.Control = VarOneEdit AnchorSideRight.Control = VarOneEdit
Left = 113 Left = 108
Height = 26 Height = 26
Top = 17 Top = 17
Width = 26 Width = 26
@ -223,11 +166,11 @@ inherited CompareDistFrm: TCompareDistFrm
Spacing = 0 Spacing = 0
TabOrder = 1 TabOrder = 1
end end
object Var1OutBtn: TBitBtn object Var1OutBtn: TBitBtn[9]
AnchorSideLeft.Control = Var1InBtn AnchorSideLeft.Control = Var1InBtn
AnchorSideTop.Control = Var1InBtn AnchorSideTop.Control = Var1InBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 113 Left = 108
Height = 26 Height = 26
Top = 47 Top = 47
Width = 26 Width = 26
@ -237,10 +180,10 @@ inherited CompareDistFrm: TCompareDistFrm
Spacing = 0 Spacing = 0
TabOrder = 2 TabOrder = 2
end end
object Label2: TLabel object Label2: TLabel[10]
AnchorSideLeft.Control = VarOneEdit AnchorSideLeft.Control = VarOneEdit
AnchorSideBottom.Control = VarOneEdit AnchorSideBottom.Control = VarOneEdit
Left = 147 Left = 142
Height = 15 Height = 15
Top = 21 Top = 21
Width = 66 Width = 66
@ -249,14 +192,14 @@ inherited CompareDistFrm: TCompareDistFrm
Caption = 'Variable One' Caption = 'Variable One'
ParentColor = False ParentColor = False
end end
object VarOneEdit: TEdit object VarOneEdit: TEdit[11]
AnchorSideLeft.Control = Var1InBtn AnchorSideLeft.Control = Var1InBtn
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = ParamsPanel AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Var1OutBtn AnchorSideBottom.Control = Var1OutBtn
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 147 Left = 142
Height = 23 Height = 23
Top = 38 Top = 38
Width = 149 Width = 149
@ -267,13 +210,13 @@ inherited CompareDistFrm: TCompareDistFrm
TabOrder = 3 TabOrder = 3
Text = 'VarOneEdit' Text = 'VarOneEdit'
end end
object CompareGroup: TRadioGroup object CompareGroup: TRadioGroup[12]
AnchorSideLeft.Control = Var1InBtn AnchorSideLeft.Control = Var1InBtn
AnchorSideTop.Control = Var1OutBtn AnchorSideTop.Control = Var1OutBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 113 Left = 108
Height = 76 Height = 76
Top = 81 Top = 81
Width = 183 Width = 183
@ -302,13 +245,13 @@ inherited CompareDistFrm: TCompareDistFrm
OnClick = CompareGroupClick OnClick = CompareGroupClick
TabOrder = 4 TabOrder = 4
end end
object Notebook: TNotebook object Notebook: TNotebook[13]
AnchorSideLeft.Control = CompareGroup AnchorSideLeft.Control = CompareGroup
AnchorSideTop.Control = CompareGroup AnchorSideTop.Control = CompareGroup
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CompareGroup AnchorSideRight.Control = CompareGroup
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 113 Left = 108
Height = 191 Height = 191
Top = 165 Top = 165
Width = 183 Width = 183
@ -522,34 +465,14 @@ inherited CompareDistFrm: TCompareDistFrm
end end
end end
end end
object PageControl1: TPageControl[1] inherited ParamsSplitter: TSplitter
Left = 317 Height = 535
end
inherited PageControl: TPageControl
Height = 519 Height = 519
Top = 8 Width = 604
Width = 599 object FreqChartPage: TTabSheet[2]
ActivePage = CumFreqChartPage
Align = alClient
BorderSpacing.Left = 4
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
TabIndex = 1
TabOrder = 1
object ReportPage: TTabSheet
Caption = 'Report'
end
object CumFreqChartPage: TTabSheet
Caption = 'Cumulative frequency plot'
end
object FreqChartPage: TTabSheet
Caption = 'Frequency plot' Caption = 'Frequency plot'
end end
end end
object ParamsSplitter: TSplitter[2]
Left = 308
Height = 535
Top = 0
Width = 5
ResizeStyle = rsPattern
end
end end

View File

@ -10,7 +10,7 @@ uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, ComCtrls, Spin, StdCtrls, Buttons, ExtCtrls, ComCtrls, Spin,
FunctionsLib, Globals, GraphLib, DataProcs, MainDM, MainUnit, FunctionsLib, Globals, GraphLib, DataProcs, MainDM, MainUnit,
BasicStatsFormUnit, ReportFrameUnit, ChartFrameUnit; BasicStatsReportAndChartFormUnit, ReportFrameUnit, ChartFrameUnit;
type type
TCompareTo = (ctTheoreticalDistrib, ctVariable); TCompareTo = (ctTheoreticalDistrib, ctVariable);
@ -18,8 +18,7 @@ type
{ TCompareDistFrm } { TCompareDistFrm }
TCompareDistFrm = class(TBasicStatsForm) TCompareDistFrm = class(TBasicStatsReportAndChartForm)
Bevel1: TBevel;
DF1Edit: TEdit; DF1Edit: TEdit;
DF2Edit: TEdit; DF2Edit: TEdit;
DistGroup: TGroupBox; DistGroup: TGroupBox;
@ -27,27 +26,19 @@ type
DF2Label: TLabel; DF2Label: TLabel;
NoIntervalsEdit: TSpinEdit; NoIntervalsEdit: TSpinEdit;
NoIntervalsLabel: TLabel; NoIntervalsLabel: TLabel;
PageControl1: TPageControl;
ParamsSplitter: TSplitter;
NormalDistChk: TRadioButton; NormalDistChk: TRadioButton;
FreqChartPage: TTabSheet; FreqChartPage: TTabSheet;
tDistChk: TRadioButton; tDistChk: TRadioButton;
ChiSqDistChk: TRadioButton; ChiSqDistChk: TRadioButton;
FDistChk: TRadioButton; FDistChk: TRadioButton;
PoissonDistChk: TRadioButton; PoissonDistChk: TRadioButton;
ReportPage: TTabSheet;
CumFreqChartPage: TTabSheet;
Notebook: TNotebook; Notebook: TNotebook;
BarPlotBtn: TSpeedButton; BarPlotBtn: TSpeedButton;
LinePlotBtn: TSpeedButton; LinePlotBtn: TSpeedButton;
TheoreticalDistPage: TPage; TheoreticalDistPage: TPage;
VariablePage: TPage; VariablePage: TPage;
ParamsPanel: TPanel;
BothChk: TCheckBox; BothChk: TCheckBox;
OptionsGroup: TGroupBox; OptionsGroup: TGroupBox;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
CompareGroup: TRadioGroup; CompareGroup: TRadioGroup;
VarOneEdit: TEdit; VarOneEdit: TEdit;
VarTwoEdit: TEdit; VarTwoEdit: TEdit;
@ -59,13 +50,8 @@ type
Var2OutBtn: TBitBtn; Var2OutBtn: TBitBtn;
Label1: TLabel; Label1: TLabel;
VarList: TListBox; VarList: TListBox;
procedure CloseBtnClick(Sender: TObject);
procedure CompareGroupClick(Sender: TObject); procedure CompareGroupClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure DistChange(Sender: TObject); procedure DistChange(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);
@ -74,10 +60,7 @@ type
procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean); procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean);
private private
FReportFrame: TReportFrame;
FCumFreqChartFrame: TChartFrame;
FFreqChartFrame: TChartFrame; FFreqChartFrame: TChartFrame;
FAutoSized: Boolean;
CompareTo: TCompareTo; CompareTo: TCompareTo;
CompareDist: TCompareDist; CompareDist: TCompareDist;
@ -88,7 +71,7 @@ type
AMin, AMax: Double; ANumIntervals, ANumCases: Integer; AMin, AMax: Double; ANumIntervals, ANumCases: Integer;
ACompareDist: TCompareDist; DF1: Integer = -1; DF2: Integer = -1); ACompareDist: TCompareDist; DF1: Integer = -1; DF2: Integer = -1);
procedure CalcIntervals(var AMin, AMax, AIntervalsize: Double; procedure CalcIntervals(var AMin, AMax, AIntervalSize: Double;
out ANumIntervals: Integer); out ANumIntervals: Integer);
function CalcMinMax(out AMin, AMax: Double; AColIndex: Integer): Integer; function CalcMinMax(out AMin, AMax: Double; AColIndex: Integer): Integer;
@ -103,14 +86,17 @@ type
procedure Plot(AChartFrame: TChartFrame; Y1Values, Y2Values: DblDyneVec; procedure Plot(AChartFrame: TChartFrame; Y1Values, Y2Values: DblDyneVec;
ASeriesTitle1, ASeriesTitle2, AYTitle, ATitle: String); ASeriesTitle1, ASeriesTitle2, AYTitle, ATitle: String);
procedure UpdateBtnStates;
procedure UpdateDF1; procedure UpdateDF1;
protected
procedure AdjustConstraints; override;
procedure Compute; override;
procedure UpdateBtnStates; override;
function Validate(ANumCases: Integer; function Validate(ANumCases: Integer;
out AMsg: String; out AControl: TWinControl): Boolean; out AMsg: String; out AControl: TWinControl): Boolean; reintroduce;
public public
constructor Create(AOwner: TComponent); override;
procedure Reset; override; procedure Reset; override;
end; end;
@ -132,6 +118,39 @@ uses
{ TCompareDistFrm } { TCompareDistFrm }
constructor TCompareDistFrm.Create(AOwner: TComponent);
begin
inherited;
ChartPage.Caption := 'Cumulative frequency plot';
FChartFrame.SetYTitle('Cumulative frequency');
FChartFrame.SetTitle('Plot of Cumulative Distributions');
FFreqChartFrame := TChartFrame.Create(self);
FFreqChartFrame.Parent := FreqChartPage;
FFreqChartFrame.Align := alClient;
FFreqChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80;
FFreqChartFrame.Chart.BottomAxis.Intervals.MinLength := 30;
FFreqChartFrame.SetYTitle('Frequency');
FFreqChartFrame.SetTitle('Plot of Distributions');
end;
procedure TCompareDistFrm.AdjustConstraints;
begin
Notebook.AutoSize := true;
ParamsPanel.Constraints.MinWidth := Max(
3*CloseBtn.Width + 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 + ButtonBevel.Height +
CloseBtn.Height + CloseBtn.BorderSpacing.Top;
end;
{ Get frequency and cumulative frequency of cases in each interval } { Get frequency and cumulative frequency of cases in each interval }
procedure TCompareDistFrm.CalcFreq(XValues, FreqValues, CumFreqValues: DblDyneVec; procedure TCompareDistFrm.CalcFreq(XValues, FreqValues, CumFreqValues: DblDyneVec;
AMin, AIncrement: Double; ANumIntervals, AColIndex: Integer); AMin, AIncrement: Double; ANumIntervals, AColIndex: Integer);
@ -199,7 +218,7 @@ begin
end; end;
procedure TCompareDistFrm.CalcIntervals(var AMin, AMax, AIntervalsize: Double; procedure TCompareDistFrm.CalcIntervals(var AMin, AMax, AIntervalSize: Double;
out ANumIntervals: Integer); out ANumIntervals: Integer);
var var
intervalSize: Double; intervalSize: Double;
@ -286,12 +305,6 @@ begin
end; end;
procedure TCompareDistFrm.CloseBtnClick(Sender: TObject);
begin
Close;
end;
procedure TCompareDistFrm.CompareGroupClick(Sender: TObject); procedure TCompareDistFrm.CompareGroupClick(Sender: TObject);
begin begin
CompareTo := TCompareTo(CompareGroup.ItemIndex); CompareTo := TCompareTo(CompareGroup.ItemIndex);
@ -299,7 +312,7 @@ begin
end; end;
procedure TCompareDistFrm.ComputeBtnClick(Sender: TObject); procedure TCompareDistFrm.Compute;
var var
var1Freq: DblDyneVec = nil; // could be IntDyneVec, but simpler charting this way var1Freq: DblDyneVec = nil; // could be IntDyneVec, but simpler charting this way
var2Freq: DblDyneVec = nil; var2Freq: DblDyneVec = nil;
@ -395,7 +408,7 @@ begin
DisplayReport(xValue1, xValue2, var1Freq, var2Freq, cumfreq1, cumFreq2, name1, name2, noInts); DisplayReport(xValue1, xValue2, var1Freq, var2Freq, cumfreq1, cumFreq2, name1, name2, noInts);
// Plot the cumulative distributions // Plot the cumulative distributions
Plot(FCumFreqChartFrame, cumFreq1, cumFreq2, VarOneEdit.Text, name2, Plot(FChartFrame, cumFreq1, cumFreq2, VarOneEdit.Text, name2,
'Cumulative Frequency', 'Plot of Cumulative Distributions'); 'Cumulative Frequency', 'Plot of Cumulative Distributions');
// Plot the frequency distrigutions, if requested. // Plot the frequency distrigutions, if requested.
@ -404,36 +417,6 @@ begin
'Frequency', 'Plot of Distributions'); 'Frequency', 'Plot of Distributions');
FreqChartPage.TabVisible := BothChk.Checked; FreqChartPage.TabVisible := BothChk.Checked;
(*
// Print distributions to report
name1 := CenterString(name1, 12);
name2 := CenterString(name2, 12);
lReport := TStringList.Create;
try
lReport.Add('DISTRIBUTION COMPARISON by Bill Miller');
lReport.Add('');
lReport.Add('%12s %12s %12s %12s %12s %12s', [
name1, name1, name1, name2, name2, name2
]);
lReport.Add('%12s %12s %12s %12s %12s %12s', [
CenterString('X1 Value', 12), CenterString('Frequency', 12), CenterString('Cum. Freq.', 12),
CenterString('X2 Value', 12), CenterString('Frequency', 12), CenterString('Cum. Freq.', 12)
]);
lReport.Add('------------ ------------ ------------ ------------ ------------ ------------');
for i := 1 to noints do
lReport.Add('%12.3f %12.0f %12.3f %12.3f %12.0f %12.3f', [
XValue1[i-1], Var1Freq[i-1], Cumfreq1[i-1], XValue2[i-1], Var2Freq[i-1], Cumfreq2[i-1]
]);
lReport.Add('');
KS := KolmogorovTest(noInts, Cumfreq1, noInts, Cumfreq2, '', lReport);
lReport.Add('Kolmogorov-Smirnov statistic: %5.3f', [KS]);
FReportFrame.DisplayReport(lReport);
finally
lReport.Free;
end;
*)
end; end;
@ -509,71 +492,6 @@ begin
end; end;
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;
FCumFreqChartFrame := TChartFrame.Create(self);
FCumFreqChartFrame.Parent := CumFreqChartPage;
FCumFreqChartFrame.Align := alClient;
FCumFreqChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80;
FCumFreqChartFrame.Chart.BottomAxis.Intervals.MinLength := 30;
FCumFreqChartFrame.SetYTitle('Cumulative frequency');
FCumFreqChartFrame.SetTitle('Plot of Cumulative Distributions');
FFreqChartFrame := TChartFrame.Create(self);
FFreqChartFrame.Parent := FreqChartPage;
FFreqChartFrame.Align := alClient;
FFreqChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80;
FFreqChartFrame.Chart.BottomAxis.Intervals.MinLength := 30;
FFreqChartFrame.SetYTitle('Frequency');
FFreqChartFrame.SetTitle('Plot of Distributions');
Reset;
end;
procedure TCompareDistFrm.Plot(AChartFrame: TChartFrame; Y1Values, Y2Values: DblDyneVec; procedure TCompareDistFrm.Plot(AChartFrame: TChartFrame; Y1Values, Y2Values: DblDyneVec;
ASeriesTitle1, ASeriesTitle2, AYTitle, ATitle: String); ASeriesTitle1, ASeriesTitle2, AYTitle, ATitle: String);
var var
@ -614,6 +532,8 @@ procedure TCompareDistFrm.Reset;
var var
i: integer; i: integer;
begin begin
inherited;
VarList.Clear; VarList.Clear;
VarOneEdit.Text := ''; VarOneEdit.Text := '';
@ -629,19 +549,14 @@ begin
NormalDistChk.Checked := true; NormalDistChk.Checked := true;
DistChange(nil); DistChange(nil);
FReportFrame.Clear; if FReportFrame <> nil then FReportFrame.Clear;
FCumFreqChartFrame.Clear; if FChartFrame <> nil then FChartFrame.Clear;
FFreqChartFrame.Clear; if FFreqChartFrame <> nil then FFreqChartFrame.Clear;
FreqChartPage.TabVisible := false; FreqChartPage.TabVisible := false;
end; end;
procedure TCompareDistFrm.ResetBtnClick(Sender: TObject);
begin
Reset;
end;
procedure TCompareDistFrm.UpdateBtnStates; procedure TCompareDistFrm.UpdateBtnStates;
begin begin
Var1InBtn.Enabled := (VarList.ItemIndex > -1) and (VarOneEdit.Text = ''); Var1InBtn.Enabled := (VarList.ItemIndex > -1) and (VarOneEdit.Text = '');
@ -649,9 +564,9 @@ begin
Var1OutBtn.Enabled := VarOneEdit.Text <> ''; Var1OutBtn.Enabled := VarOneEdit.Text <> '';
Var2OutBtn.Enabled := VarTwoEdit.Text <> ''; Var2OutBtn.Enabled := VarTwoEdit.Text <> '';
FReportFrame.UpdateBtnStates; if FReportFrame <> nil then FReportFrame.UpdateBtnStates;
FCumFreqChartFrame.UpdateBtnStates; if FChartFrame <> nil then FChartFrame.UpdateBtnStates;
FFreqChartFrame.UpdateBtnStates; if FFreqChartFrame <> nil then FFreqChartFrame.UpdateBtnStates;
end; end;