LazStats: fine-tuning and chm help file update of BoxPlotUnit and BubblePlotUnit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8025 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-05-11 13:55:25 +00:00
parent 9a4ebebaa1
commit 81963e634c
8 changed files with 52 additions and 63 deletions

Binary file not shown.

View File

@ -241,7 +241,7 @@
<Unit16> <Unit16>
<Filename Value="forms\analysis\descriptive\boxplotunit.pas"/> <Filename Value="forms\analysis\descriptive\boxplotunit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="BoxPlotFrm"/> <ComponentName Value="BoxPlotForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="BoxPlotUnit"/> <UnitName Value="BoxPlotUnit"/>

View File

@ -1,10 +1,10 @@
inherited BoxPlotFrm: TBoxPlotFrm inherited BoxPlotForm: TBoxPlotForm
Left = 449 Left = 449
Height = 500 Height = 500
Top = 211 Top = 211
Width = 1000 Width = 1000
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/BoxPlots.htm' HelpKeyword = 'html/BoxPlot.htm'
Caption = 'Box Plot' Caption = 'Box Plot'
ClientHeight = 500 ClientHeight = 500
ClientWidth = 1000 ClientWidth = 1000
@ -31,6 +31,8 @@ inherited BoxPlotFrm: TBoxPlotFrm
inherited HelpBtn: TButton inherited HelpBtn: TButton
Left = 73 Left = 73
Top = 459 Top = 459
HelpType = htKeyword
HelpKeyword = 'html/BoxPlot.htm'
TabOrder = 7 TabOrder = 7
end end
inherited ButtonBevel: TBevel inherited ButtonBevel: TBevel

View File

@ -16,9 +16,9 @@ uses
type type
{ TBoxPlotFrm } { TBoxPlotForm }
TBoxPlotFrm = class(TBasicStatsReportAndChartForm) TBoxPlotForm = class(TBasicStatsReportAndChartForm)
MeasEdit: TEdit; MeasEdit: TEdit;
GroupEdit: TEdit; GroupEdit: TEdit;
Label1: TLabel; Label1: TLabel;
@ -52,7 +52,7 @@ type
end; end;
var var
BoxPlotFrm: TBoxPlotFrm; BoxPlotForm: TBoxPlotForm;
implementation implementation
@ -66,9 +66,9 @@ const
BOX_COLORS: Array[0..3] of TColor = (clBlue, clGreen, clFuchsia, clLime); BOX_COLORS: Array[0..3] of TColor = (clBlue, clGreen, clFuchsia, clLime);
{ TBoxPlotFrm } { TBoxPlotForm }
constructor TBoxPlotFrm.Create(AOwner: TComponent); constructor TBoxPlotForm.Create(AOwner: TComponent);
begin begin
inherited; inherited;
@ -78,7 +78,7 @@ begin
end; end;
procedure TBoxPlotFrm.BoxPlot(const LowQrtl, HiQrtl, TenPcnt, NinetyPcnt, Medians: DblDyneVec); procedure TBoxPlotForm.BoxPlot(const LowQrtl, HiQrtl, TenPcnt, NinetyPcnt, Medians: DblDyneVec);
var var
i: Integer; i: Integer;
ser: TBoxAndWhiskerSeries; ser: TBoxAndWhiskerSeries;
@ -115,7 +115,7 @@ begin
end; end;
procedure TBoxPlotFrm.Compute; procedure TBoxPlotForm.Compute;
var var
lReport: TStrings; lReport: TStrings;
i, j, k, GrpVar, MeasVar, mingrp, maxgrp, G, NoGrps, cnt: integer; i, j, k, GrpVar, MeasVar, mingrp, maxgrp, G, NoGrps, cnt: integer;
@ -137,30 +137,24 @@ var
Median: DblDyneVec = nil; Median: DblDyneVec = nil;
ColNoSelected: IntDyneVec = nil; ColNoSelected: IntDyneVec = nil;
begin begin
GrpVar := GetVariableIndex(OS3MainFrm.DataGrid, GroupEdit.Text);
MeasVar := GetVariableIndex(OS3MainFrm.DataGrid, MeasEdit.Text);
if GrpVar = -1 then
begin
ErrorMsg('Group variable not selected.');
exit;
end;
if MeasVar = -1 then
begin
ErrorMsg('Measurement variable not selected.');
exit;
end;
lReport := TStringList.Create; lReport := TStringList.Create;
try try
lReport.Add('BOX PLOTS OF GROUPS'); lReport.Add('BOX PLOTS OF GROUPS');
lReport.Add(''); lReport.Add('');
GrpVar := 0;
MeasVar := 0;
for i := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
if cellstring = GroupEdit.Text then GrpVar := i;
if cellstring = MeasEdit.Text then MeasVar := i;
end;
if GrpVar = 0 then
begin
ErrorMsg('Group variable not selected.');
exit;
end;
if MeasVar = 0 then
begin
ErrorMsg('Measurement variable not selected.');
exit;
end;
SetLength(ColNoSelected, 2); SetLength(ColNoSelected, 2);
ColNoSelected[0] := GrpVar; ColNoSelected[0] := GrpVar;
ColNoSelected[1] := MeasVar; ColNoSelected[1] := MeasVar;
@ -330,7 +324,7 @@ begin
end; end;
procedure TBoxPlotFrm.AdjustConstraints; procedure TBoxPlotForm.AdjustConstraints;
begin begin
inherited; inherited;
@ -343,7 +337,7 @@ begin
end; end;
procedure TBoxPlotFrm.GrpInBtnClick(Sender: TObject); procedure TBoxPlotForm.GrpInBtnClick(Sender: TObject);
var var
index: integer; index: integer;
begin begin
@ -357,7 +351,7 @@ begin
end; end;
procedure TBoxPlotFrm.GrpOutBtnClick(Sender: TObject); procedure TBoxPlotForm.GrpOutBtnClick(Sender: TObject);
begin begin
if GroupEdit.Text <> '' then if GroupEdit.Text <> '' then
begin begin
@ -368,7 +362,7 @@ begin
end; end;
procedure TBoxPlotFrm.MeasInBtnClick(Sender: TObject); procedure TBoxPlotForm.MeasInBtnClick(Sender: TObject);
var var
index: integer; index: integer;
begin begin
@ -382,7 +376,7 @@ begin
end; end;
procedure TBoxPlotFrm.MeasOutBtnClick(Sender: TObject); procedure TBoxPlotForm.MeasOutBtnClick(Sender: TObject);
begin begin
if MeasEdit.Text <> '' then if MeasEdit.Text <> '' then
begin begin
@ -392,7 +386,7 @@ begin
end; end;
end; end;
function TBoxPlotFrm.Percentile(nScoreGrps: integer; function TBoxPlotForm.Percentile(nScoreGrps: integer;
APercentile: double; const Freq, CumFreq, Scores: DblDyneVec): double; APercentile: double; const Freq, CumFreq, Scores: DblDyneVec): double;
var var
i, interval: integer; i, interval: integer;
@ -429,7 +423,7 @@ begin
end; end;
procedure TBoxPlotFrm.Reset; procedure TBoxPlotForm.Reset;
begin begin
inherited; inherited;
@ -441,7 +435,7 @@ begin
end; end;
procedure TBoxPlotFrm.UpdateBtnStates; procedure TBoxPlotForm.UpdateBtnStates;
begin begin
inherited; inherited;
@ -453,7 +447,7 @@ begin
end; end;
procedure TBoxPlotFrm.VarListDblClick(Sender: TObject); procedure TBoxPlotForm.VarListDblClick(Sender: TObject);
var var
index: integer; index: integer;
begin begin
@ -470,7 +464,7 @@ begin
end; end;
procedure TBoxPlotFrm.VarListSelectionChange(Sender: TObject; User: boolean); procedure TBoxPlotForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin begin
UpdateBtnStates; UpdateBtnStates;
end; end;

View File

@ -31,6 +31,8 @@ inherited BubbleForm: TBubbleForm
inherited HelpBtn: TButton inherited HelpBtn: TButton
Left = 116 Left = 116
Top = 424 Top = 424
HelpType = htKeyword
HelpKeyword = 'html/RepeatedMeasuresBubblePlot.htm'
TabOrder = 5 TabOrder = 5
end end
inherited ButtonBevel: TBevel inherited ButtonBevel: TBevel

View File

@ -77,7 +77,8 @@ implementation
{$R *.lfm} {$R *.lfm}
uses uses
TAChartUtils, TALegend, TAMultiSeries; TAChartUtils, TALegend, TAMultiSeries,
Utils, GridProcs;
{ TBubbleForm } { TBubbleForm }
@ -96,15 +97,14 @@ begin
inherited; inherited;
Panel1.Constraints.MinHeight := SizeOutBtn.Top + SizeOutBtn.Height; Panel1.Constraints.MinHeight := SizeOutBtn.Top + SizeOutBtn.Height;
ParamsPanel.Constraints.MinHeight := Panel1.Height + Panel1.BorderSpacing.Bottom + ParamsPanel.Constraints.MinHeight := Panel1.Height + Panel1.BorderSpacing.Bottom +
3*TitleEdit.Height + 2*XLabelEdit.BorderSpacing.Top + 3*TitleEdit.Height + 2*XLabelEdit.BorderSpacing.Top +
TransformChk.BorderSpacing.Top + TransformChk.Height + TransformChk.BorderSpacing.Bottom + TransformChk.BorderSpacing.Top + TransformChk.Height + TransformChk.BorderSpacing.Bottom +
ButtonBevel.Height + ButtonBevel.Height +
CloseBtn.Height + CloseBtn.BorderSpacing.Top; CloseBtn.Height + CloseBtn.BorderSpacing.Top;
ParamsPanel.Constraints.MinWidth := Max(TransformChk.Width, 4*CloseBtn.Width + 3*HelpBtn.BorderSpacing.Right);
Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 200; ParamsPanel.Constraints.MinWidth := Max(TransformChk.Width, 4*CloseBtn.Width + 3*HelpBtn.BorderSpacing.Right);
Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + 2*ParamsPanel.BorderSpacing.Top;
end; end;
@ -113,7 +113,6 @@ var
i, j, cell: integer; i, j, cell: integer;
Xmin, Xmax, intcell, noreplications, minrep, maxrep: integer; Xmin, Xmax, intcell, noreplications, minrep, maxrep: integer;
nobubbles: integer; nobubbles: integer;
varname: string;
Ymin, Ymax, xvalue, yvalue, sizeValue, cellValue: double; Ymin, Ymax, xvalue, yvalue, sizeValue, cellValue: double;
BubMin, BubMax: double; BubMin, BubMax: double;
ncases, ncols, BubbleID, newcol: integer; ncases, ncols, BubbleID, newcol: integer;
@ -129,21 +128,13 @@ var
begin begin
inherited; inherited;
BubbleCol := 0; BubbleCol := GetVariableIndex(OS3MainFrm.DataGrid, BubbleEdit.Text);
XCol := 0; XCol := GetVariableIndex(OS3MainFrm.DataGrid, XEdit.Text);
YCol := 0; YCol := GetVariableIndex(OS3MainFrm.DataGrid, YEdit.Text);
SizeCol := 0; SizeCol := GetVariableIndex(OS3MainFrm.DataGrid, SizeEdit.Text);
for i := 1 to NoVariables do if ((BubbleCol = -1) or (XCol = -1) or (YCol = -1) or (SizeCol = -1)) then
begin begin
varname := OS3MainFrm.DataGrid.Cells[i,0]; ErrorMsg('One or more variables not found.');
if (varname = BubbleEdit.Text) then BubbleCol := i;
if (varname = XEdit.Text) then XCol := i;
if (varname = YEdit.Text) then YCol := i;
if (varname = SizeEdit.Text) then SizeCol := i;
end;
if ((BubbleCol = 0) or (XCol = 0) or (YCol = 0) or (SizeCol = 0)) then
begin
MessageDlg('One or more variables not found.', mtError, [mbOK], 0);
ModalResult := mrNone; ModalResult := mrNone;
Exit; Exit;
end; end;

View File

@ -1896,12 +1896,12 @@ end;
// Menu "Analysis" > "Descriptive" > "Box Plot" // Menu "Analysis" > "Descriptive" > "Box Plot"
procedure TOS3MainFrm.mnuAnalysisDescr_BoxPlotClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisDescr_BoxPlotClick(Sender: TObject);
begin begin
if BoxPlotFrm = nil then if BoxPlotForm = nil then
Application.CreateForm(TBoxPlotFrm, BoxPlotFrm); Application.CreateForm(TBoxPlotForm, BoxPlotForm);
BoxPlotFrm.Show; BoxPlotForm.Show;
end; end;
// Menu "Analysis" > "Descriptive" > "mnuAnalysisDescr_Breakdown" // Menu "Analysis" > "Descriptive" > "reakdown"
procedure TOS3MainFrm.mnuAnalysisDescr_BreakdownClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisDescr_BreakdownClick(Sender: TObject);
begin begin
if BreakDownFrm = nil then if BreakDownFrm = nil then
@ -1917,7 +1917,7 @@ begin
BubbleForm.Show; BubbleForm.Show;
end; end;
// Menu "Analysis" > "Descriptive" > "Compare mnuAnalysisDescr_DistribStats" // Menu "Analysis" > "Descriptive" > "Compare Distributions"
procedure TOS3MainFrm.mnuAnalysisDescr_CompareDistsClick(Sender: TObject); procedure TOS3MainFrm.mnuAnalysisDescr_CompareDistsClick(Sender: TObject);
begin begin
if CompareDistFrm = nil then if CompareDistFrm = nil then