LazStats: Fix bug in NormalDist. Nicer report layout in CompareDistUnit.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7724 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-09-30 21:52:40 +00:00
parent 10049ca6b0
commit 8092e5e9fa
4 changed files with 114 additions and 60 deletions

View File

@ -28,15 +28,16 @@ procedure Exchange(var a, b: String); overload;
procedure SortOnX(X: DblDyneVec; Y: DblDyneVec = nil; Z: DblDyneVec = nil);
procedure SortOnX(X: DblDyneVec; Y: DblDyneMat);
procedure QuickSortOnX(X: DblDyneVec; Y: DblDyneVec = nil; Z: DblDyneVec = nil);
procedure QuickSortOnX(X: DblDyneVec; Y: DblDyneVec = nil; Z: DblDyneVec = nil); // not 100% tested...
function CenterString(S: String; Width: Integer): String;
function IndexOfString(L: StrDyneVec; s: String): Integer;
implementation
uses
Math, ToolWin;
StrUtils, Math, ToolWin;
// https://stackoverflow.com/questions/4093595/create-ttoolbutton-runtime
procedure AddButtonToToolbar(AToolButton: TToolButton; AToolBar: TToolBar);
@ -225,6 +226,28 @@ begin
DoQuickSort(0, High(X));
end;
function CenterString(S: String; Width: Integer): String;
var
n1, n2: Integer;
begin
n1 := Width - Length(S);
if n1 <= 0 then
begin
Result := S;
exit;
end;
n1 := n1 div 2;
if Length(S) + 2*n1 < Width then
n2 := n1+1
else
n2 := n1;
Result := DupeString(' ', n1) + S + DupeString(' ', n2);
end;
function IndexOfString(L: StrDyneVec; s: String): Integer;
var
i: Integer;