LazStats: Fine-tuning and update of chm file of FreqUnit.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8020 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-05-10 11:34:16 +00:00
parent 5367160635
commit 109bbaf9ce
5 changed files with 37 additions and 22 deletions

Binary file not shown.

View File

@@ -32,6 +32,7 @@ inherited FreqFrm: TFreqFrm
Left = 4 Left = 4
Top = 344 Top = 344
TabOrder = 7 TabOrder = 7
Visible = False
end end
inherited ButtonBevel: TBevel inherited ButtonBevel: TBevel
Top = 328 Top = 328
@@ -178,13 +179,13 @@ inherited FreqFrm: TFreqFrm
Left = 0 Left = 0
Height = 52 Height = 52
Top = 276 Top = 276
Width = 255 Width = 270
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Top = 8 BorderSpacing.Top = 8
Caption = 'Plot Options' Caption = 'Plot Options'
ClientHeight = 32 ClientHeight = 32
ClientWidth = 251 ClientWidth = 266
TabOrder = 2 TabOrder = 2
object VertBarsBtn: TSpeedButton object VertBarsBtn: TSpeedButton
AnchorSideLeft.Control = PlotOptionsGroup AnchorSideLeft.Control = PlotOptionsGroup
@@ -260,20 +261,19 @@ inherited FreqFrm: TFreqFrm
end end
object BinSelectionGroup: TGroupBox[8] object BinSelectionGroup: TGroupBox[8]
AnchorSideLeft.Control = ParamsPanel AnchorSideLeft.Control = ParamsPanel
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = PlotOptionsGroup AnchorSideBottom.Control = PlotOptionsGroup
Left = 0 Left = 0
Height = 57 Height = 57
Top = 211 Top = 211
Width = 255 Width = 270
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Top = 12 BorderSpacing.Top = 12
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Bin Selection' Caption = 'Bin Selection'
ClientHeight = 37 ClientHeight = 37
ClientWidth = 251 ClientWidth = 266
TabOrder = 3 TabOrder = 3
object Panel2: TPanel object Panel2: TPanel
AnchorSideLeft.Control = BinSelectionGroup AnchorSideLeft.Control = BinSelectionGroup
@@ -282,20 +282,20 @@ inherited FreqFrm: TFreqFrm
Left = 12 Left = 12
Height = 23 Height = 23
Top = 2 Top = 2
Width = 239 Width = 254
AutoSize = True AutoSize = True
BorderSpacing.Left = 12 BorderSpacing.Left = 12
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 23 ClientHeight = 23
ClientWidth = 239 ClientWidth = 254
TabOrder = 0 TabOrder = 0
object NoIntervalsEdit: TSpinEdit object NoIntervalsEdit: TSpinEdit
AnchorSideLeft.Control = NoIntervalsLabel AnchorSideLeft.Control = NoIntervalsLabel
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel2 AnchorSideTop.Control = Panel2
Left = 165 Left = 180
Height = 23 Height = 23
Top = 0 Top = 0
Width = 66 Width = 66
@@ -313,8 +313,8 @@ inherited FreqFrm: TFreqFrm
Left = 0 Left = 0
Height = 15 Height = 15
Top = 4 Top = 4
Width = 149 Width = 164
Caption = 'Approximate No of intervals' Caption = 'Approximate count of intervals'
ParentColor = False ParentColor = False
end end
end end

View File

@@ -69,7 +69,6 @@ var
FreqFrm: TFreqFrm; FreqFrm: TFreqFrm;
implementation implementation
{$R *.lfm} {$R *.lfm}
@@ -92,15 +91,18 @@ procedure TFreqFrm.AdjustConstraints;
begin begin
Panel1.Constraints.MinHeight := AllBtn.Top + AllBtn.Height; Panel1.Constraints.MinHeight := AllBtn.Top + AllBtn.Height;
Panel1.Constraints.MinWidth := Max(Label1.Width, Label2.Width) + AllBtn.Width + VarList.BorderSpacing.Right*2; Panel1.Constraints.MinWidth := Max(Label1.Width, Label2.Width) + AllBtn.Width + VarList.BorderSpacing.Right*2;
ParamsPanel.Constraints.MinHeight := Panel1.Constraints.MinHeight + ParamsPanel.Constraints.MinHeight := Panel1.Constraints.MinHeight +
NormPltChk.BorderSpacing.Top + NormPltChk.Height + NormPltChk.BorderSpacing.Top + NormPltChk.Height +
BinSelectionGroup.BorderSpacing.Top + BinSelectionGroup.Height + BinSelectionGroup.BorderSpacing.Top + BinSelectionGroup.Height +
PlotOptionsGroup.BorderSpacing.Top + PlotOptionsGroup.Height + PlotOptionsGroup.BorderSpacing.Top + PlotOptionsGroup.Height +
ButtonBevel.Height + ButtonBevel.Height +
CloseBtn.BorderSpacing.Top + CloseBtn.Height; CloseBtn.BorderSpacing.Top + CloseBtn.Height;
ParamsPanel.Constraints.MinWidth := Max( ParamsPanel.Constraints.MinWidth := MaxValue([
4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left, CountUsedButtons*CloseBtn.Width + (CountUsedButtons-1)*CloseBtn.BorderSpacing.Left,
Panel1.Constraints.MinWidth) + ParamsPanel.BorderSpacing.left*2; BinSelectionGroup.Width,
Panel1.Constraints.MinWidth
]);
end; end;
@@ -247,14 +249,14 @@ begin
// Get cumulative frequencies and percents to midpoints // Get cumulative frequencies and percents to midpoints
cumFreq[0] := freq[0]; cumFreq[0] := freq[0];
pcnt[0] := freq[0] / nCases; pcnt[0] := freq[0] / nCases * 100;
cumPcnt[0] := cumFreq[0] / nCases; cumPcnt[0] := cumFreq[0] / nCases * 100;
pcntileRank[0] := (freq[0] * 0.5) / nCases; pcntileRank[0] := (freq[0] * 0.5) / nCases;
for k := 1 to nInts - 1 do for k := 1 to nInts - 1 do
begin begin
cumfreq[k] := cumfreq[k-1] + freq[k]; cumfreq[k] := cumfreq[k-1] + freq[k];
pcnt[k] := freq[k] / nCases; pcnt[k] := freq[k] / nCases * 100;
cumPcnt[k] := cumFreq[k] / nCases; cumPcnt[k] := cumFreq[k] / nCases * 100;
pcntileRank[k] := (cumFreq[k-1] + freq[k] * 0.5) / nCases; pcntileRank[k] := (cumFreq[k-1] + freq[k] * 0.5) / nCases;
end; end;
@@ -300,10 +302,11 @@ begin
end; end;
// Print results to report // Print results to report
lReport.Add(' FROM TO FREQ. PCNT CUM.FREQ. CUM.PCNT. %ILE RANK ND FREQ.');
lReport.Add(''); lReport.Add('');
lReport.Add(' FROM >= TO < FREQ. PERCENT CUM.FREQ. CUM.PCNT. %ILE RANK ND FREQ.');
lReport.Add('-------- -------- -------- -------- --------- --------- --------- --------');
for k := 0 to nInts - 1 do for k := 0 to nInts - 1 do
lReport.Add('%8.2f%8.2f%8.0f%8.2f %8.2f %8.2f %8.2f %8.2f', [ lReport.Add('%8.2f %8.2f %8.0f %8.2f %9.2f %9.2f %9.2f %8.2f', [
min + k*incrSize, // from min + k*incrSize, // from
min + (k+1)*incrSize, // to min + (k+1)*incrSize, // to
freq[k], // freq freq[k], // freq
@@ -317,10 +320,11 @@ begin
else else
begin begin
// Print results to report // Print results to report
lReport.Add(' FROM TO FREQ. PCNT CUM.FREQ. CUM.PCNT. %ILE RANK');
lReport.Add(''); lReport.Add('');
lReport.Add(' FROM >= TO < FREQ. PERCENT CUM.FREQ. CUM.PCNT. %ILE RANK');
lReport.Add('-------- -------- -------- -------- --------- --------- ---------');
for k := 0 to nInts - 1 do for k := 0 to nInts - 1 do
lReport.Add('%8.2f%8.2f%8.0f%8.2f %8.2f %8.2f %8.2f', [ lReport.Add('%8.2f %8.2f %8.0f %8.2f %9.2f %9.2f %9.2f', [
min + k*incrSize, // from min + k*incrSize, // from
min + (k+1)*incrSize, // to min + (k+1)*incrSize, // to
freq[k], // freq freq[k], // freq

View File

@@ -32,6 +32,7 @@ type
procedure Activate; override; procedure Activate; override;
procedure AdjustConstraints; virtual; procedure AdjustConstraints; virtual;
procedure Compute; virtual; procedure Compute; virtual;
function CountUsedButtons: Integer;
procedure InitForm; virtual; procedure InitForm; virtual;
procedure UpdateBtnStates; virtual; procedure UpdateBtnStates; virtual;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; virtual; function Validate(out AMsg: String; out AControl: TWinControl): Boolean; virtual;
@@ -142,6 +143,16 @@ begin
end; end;
function TBasicStatsParamsForm.CountUsedButtons: Integer;
begin
Result := 0;
if HelpBtn.Visible then inc(Result);
if ResetBtn.Visible then inc(Result);
if ComputeBtn.Visible then inc(Result);
if CloseBtn.Visible then inc(Result);
end;
procedure TBasicStatsParamsForm.HelpBtnClick(Sender: TObject); procedure TBasicStatsParamsForm.HelpBtnClick(Sender: TObject);
begin begin
if ContextHelpForm = nil then if ContextHelpForm = nil then