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

View File

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

View File

@ -32,6 +32,7 @@ type
procedure Activate; override;
procedure AdjustConstraints; virtual;
procedure Compute; virtual;
function CountUsedButtons: Integer;
procedure InitForm; virtual;
procedure UpdateBtnStates; virtual;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; virtual;
@ -142,6 +143,16 @@ begin
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);
begin
if ContextHelpForm = nil then