LazStats: Integrate Report and Chart in form of XvsMultYUnit.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7687 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-09-22 13:20:08 +00:00
parent 84e1cce0ed
commit 3395fc8847
10 changed files with 524 additions and 594 deletions

View File

@ -1,26 +1,26 @@
object BoxPlotFrm: TBoxPlotFrm
Left = 1155
Height = 387
Top = 194
Width = 817
Left = 449
Height = 500
Top = 211
Width = 1000
HelpType = htKeyword
HelpKeyword = 'html/BoxPlots.htm'
Caption = 'Box Plot'
ClientHeight = 387
ClientWidth = 817
ClientHeight = 500
ClientWidth = 1000
OnActivate = FormActivate
OnCreate = FormCreate
Position = poMainFormCenter
LCLVersion = '2.1.0.0'
object ParamsPanel: TPanel
Left = 8
Height = 371
Height = 484
Top = 8
Width = 333
Align = alLeft
BorderSpacing.Around = 8
BevelOuter = bvNone
ClientHeight = 371
ClientHeight = 484
ClientWidth = 333
TabOrder = 0
object CloseBtn: TButton
@ -30,7 +30,7 @@ object BoxPlotFrm: TBoxPlotFrm
AnchorSideBottom.Side = asrBottom
Left = 278
Height = 25
Top = 346
Top = 459
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
@ -46,7 +46,7 @@ object BoxPlotFrm: TBoxPlotFrm
AnchorSideBottom.Side = asrBottom
Left = 194
Height = 25
Top = 346
Top = 459
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
@ -63,7 +63,7 @@ object BoxPlotFrm: TBoxPlotFrm
AnchorSideBottom.Side = asrBottom
Left = 132
Height = 25
Top = 346
Top = 459
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
@ -81,7 +81,7 @@ object BoxPlotFrm: TBoxPlotFrm
AnchorSideBottom.Side = asrBottom
Left = 73
Height = 25
Top = 346
Top = 459
Width = 51
Anchors = [akRight, akBottom]
AutoSize = True
@ -98,7 +98,7 @@ object BoxPlotFrm: TBoxPlotFrm
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 330
Top = 443
Width = 333
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
@ -120,7 +120,7 @@ object BoxPlotFrm: TBoxPlotFrm
AnchorSideRight.Control = MeasInBtn
AnchorSideBottom.Control = Bevel2
Left = 0
Height = 313
Height = 426
Top = 17
Width = 145
Anchors = [akTop, akLeft, akRight, akBottom]
@ -267,16 +267,16 @@ object BoxPlotFrm: TBoxPlotFrm
end
object ParamsSplitter: TSplitter
Left = 349
Height = 387
Height = 500
Top = 0
Width = 5
ResizeStyle = rsPattern
end
object PageControl1: TPageControl
Left = 362
Height = 371
Height = 484
Top = 8
Width = 447
Width = 630
ActivePage = ReportPage
Align = alClient
BorderSpacing.Around = 8

View File

@ -387,6 +387,9 @@ procedure TBoxPlotFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
Width := Scale96ToFont(DEFAULT_WIDTH);
Height := Scale96ToFont(DEFAULT_HEIGHT);
FReportFrame := TReportFrame.Create(self);
FReportFrame.Parent := ReportPage;
FReportFrame.Align := alClient;

View File

@ -400,6 +400,9 @@ begin
Assert(OS3MainFrm <> nil);
if DictionaryFrm = nil then Application.CreateForm(TDictionaryFrm, DictionaryFrm);
Width := Scale96ToFont(DEFAULT_WIDTH);
Height := Scale96ToFont(DEFAULT_HEIGHT);
FReportFrame := TReportFrame.Create(self);
FReportFrame.Parent := ReportPage;
FReportFrame.Align := alClient;
@ -617,6 +620,9 @@ begin
XOutBtn.Enabled := XEdit.Text <> '';
YOutBtn.Enabled := YEdit.Text <> '';
SizeOutBtn.Enabled := SizeEdit.Text <> '';
FReportFrame.UpdateBtnStates;
FChartFrame.UpdateBtnStates;
end;

View File

@ -128,6 +128,9 @@ begin
Assert(OS3MainFrm <> nil);
if DictionaryFrm = nil then Application.CreateForm(TDictionaryFrm, DictionaryFrm);
Width := Scale96ToFont(DEFAULT_WIDTH);
Height := Scale96ToFont(DEFAULT_HEIGHT);
FReportFrame := TReportFrame.Create(self);
FReportFrame.Parent := ReportPanel;
FReportFrame.Align := alClient;

View File

@ -1,26 +1,26 @@
object PlotXYFrm: TPlotXYFrm
Left = 522
Height = 348
Top = 172
Width = 847
Left = 427
Height = 500
Top = 175
Width = 1000
HelpType = htKeyword
HelpKeyword = 'html/XVersusYPlot.htm'
Caption = 'Plot X versus Y'
ClientHeight = 348
ClientWidth = 847
ClientHeight = 500
ClientWidth = 1000
OnActivate = FormActivate
OnCreate = FormCreate
Position = poMainFormCenter
LCLVersion = '2.1.0.0'
object ParamsPanel: TPanel
Left = 8
Height = 332
Height = 484
Top = 8
Width = 376
Align = alLeft
BorderSpacing.Around = 8
BevelOuter = bvNone
ClientHeight = 332
ClientHeight = 484
ClientWidth = 376
TabOrder = 0
object CloseBtn: TButton
@ -30,7 +30,7 @@ object PlotXYFrm: TPlotXYFrm
AnchorSideBottom.Side = asrBottom
Left = 314
Height = 25
Top = 307
Top = 459
Width = 62
Anchors = [akRight, akBottom]
BorderSpacing.Left = 8
@ -46,7 +46,7 @@ object PlotXYFrm: TPlotXYFrm
AnchorSideBottom.Side = asrBottom
Left = 230
Height = 25
Top = 307
Top = 459
Width = 76
Anchors = [akRight, akBottom]
BorderSpacing.Left = 8
@ -62,7 +62,7 @@ object PlotXYFrm: TPlotXYFrm
AnchorSideBottom.Side = asrBottom
Left = 168
Height = 25
Top = 307
Top = 459
Width = 54
Anchors = [akRight, akBottom]
BorderSpacing.Left = 12
@ -79,7 +79,7 @@ object PlotXYFrm: TPlotXYFrm
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 291
Top = 443
Width = 376
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
@ -102,7 +102,7 @@ object PlotXYFrm: TPlotXYFrm
AnchorSideBottom.Control = Bevel1
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 274
Height = 426
Top = 17
Width = 167
Anchors = [akTop, akLeft, akRight, akBottom]
@ -326,16 +326,16 @@ object PlotXYFrm: TPlotXYFrm
end
object ParamsSplitter: TSplitter
Left = 392
Height = 348
Height = 500
Top = 0
Width = 5
ResizeStyle = rsPattern
end
object PageControl1: TPageControl
Left = 405
Height = 332
Height = 484
Top = 8
Width = 434
Width = 587
ActivePage = ChartPage
Align = alClient
BorderSpacing.Around = 8

View File

@ -377,6 +377,9 @@ procedure TPlotXYFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
Width := Scale96ToFont(DEFAULT_WIDTH);
Height := Scale96ToFont(DEFAULT_HEIGHT);
FReportFrame := TReportFrame.Create(self);
FReportFrame.Parent := ReportPage;
FReportFrame.Align := alClient;

View File

@ -1,379 +1,374 @@
object XvsMultYForm: TXvsMultYForm
Left = 288
Height = 467
Height = 500
Top = 117
Width = 452
Width = 1000
HelpType = htKeyword
HelpKeyword = 'html/PlotXVersusMultipleYValues.htm'
Caption = 'X vs Multiple Y Plot'
ClientHeight = 467
ClientWidth = 452
ClientHeight = 500
ClientWidth = 1000
OnActivate = FormActivate
OnCreate = FormCreate
OnShow = ResetBtnClick
Position = poMainFormCenter
LCLVersion = '2.1.0.0'
object Label4: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = PlotTitleEdit
AnchorSideTop.Side = asrCenter
object ParamsPanel: TPanel
Left = 8
Height = 15
Top = 332
Width = 49
BorderSpacing.Left = 8
Caption = 'Plot Title:'
ParentColor = False
end
object PlotTitleEdit: TEdit
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 65
Height = 23
Top = 328
Width = 379
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
TabOrder = 1
TextHint = 'Title above the chart'
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Bevel2
Left = 8
Height = 51
Top = 359
Width = 336
Anchors = [akLeft, akBottom]
AutoSize = True
Height = 484
Top = 8
Width = 296
Align = alLeft
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Bottom = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 24
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsScaleChilds
ChildSizing.EnlargeVertical = crsScaleChilds
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 31
ClientWidth = 332
TabOrder = 2
object DescChk: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 127
BorderSpacing.Left = 12
BorderSpacing.Top = 2
Caption = 'Descriptive Statistics'
Checked = True
State = cbChecked
TabOrder = 0
end
object LinesBox: TCheckBox
AnchorSideTop.Side = asrBottom
Left = 163
Height = 19
Top = 6
Width = 157
BorderSpacing.Left = 12
BorderSpacing.Top = 2
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
Caption = 'Connect Points with Lines'
TabOrder = 1
end
end
object Panel1: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Memo1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = PlotTitleEdit
Left = 8
Height = 214
Top = 106
Width = 436
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Right = 4
BorderSpacing.Bottom = 8
BevelOuter = bvNone
ClientHeight = 214
ClientWidth = 436
Constraints.MinHeight = 200
ClientHeight = 484
ClientWidth = 296
TabOrder = 0
object Label1: TLabel
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
object Panel1: TPanel
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = ParamsPanel
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = PlotTitleEdit
Left = 0
Height = 15
Height = 345
Top = 0
Width = 49
Caption = 'Variables:'
ParentColor = False
end
object VarList: TListBox
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = XInBtn
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 197
Top = 17
Width = 196
Width = 296
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
BorderSpacing.Bottom = 8
BevelOuter = bvNone
ClientHeight = 345
ClientWidth = 296
TabOrder = 0
object Label1: TLabel
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
Left = 0
Height = 15
Top = 0
Width = 49
Caption = 'Variables:'
ParentColor = False
end
object VarList: TListBox
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = XInBtn
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 328
Top = 17
Width = 126
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0
MultiSelect = True
OnDblClick = VarListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 0
end
object XInBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 134
Height = 28
Top = 17
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = XInBtnClick
Spacing = 0
TabOrder = 1
end
object XOutBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = XInBtn
AnchorSideTop.Side = asrBottom
Left = 134
Height = 28
Top = 49
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = XOutBtnClick
Spacing = 0
TabOrder = 2
end
object YInBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = XOutBtn
AnchorSideTop.Side = asrBottom
Left = 134
Height = 28
Top = 101
Width = 28
BorderSpacing.Top = 24
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = YInBtnClick
Spacing = 0
TabOrder = 4
end
object YOutBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = YInBtn
AnchorSideTop.Side = asrBottom
Left = 134
Height = 28
Top = 133
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = YOutBtnClick
Spacing = 0
TabOrder = 5
end
object Label2: TLabel
AnchorSideLeft.Control = XEdit
AnchorSideBottom.Control = XEdit
Left = 170
Height = 15
Top = 25
Width = 54
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'X Variable:'
ParentColor = False
end
object Label3: TLabel
AnchorSideLeft.Control = YBox
AnchorSideTop.Control = YInBtn
Left = 170
Height = 15
Top = 101
Width = 64
BorderSpacing.Bottom = 2
Caption = 'Y Variable(s)'
ParentColor = False
end
object XEdit: TEdit
AnchorSideLeft.Control = XInBtn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = XOutBtn
AnchorSideBottom.Side = asrBottom
Left = 170
Height = 23
Top = 42
Width = 126
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'XEdit'
end
object YBox: TListBox
AnchorSideLeft.Control = YInBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 170
Height = 227
Top = 118
Width = 126
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 6
end
end
object XInBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 204
Height = 28
Top = 17
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = XInBtnClick
Spacing = 0
object CloseBtn: TButton
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom
Left = 241
Height = 25
Top = 459
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Close'
ModalResult = 11
OnClick = CloseBtnClick
TabOrder = 1
end
object XOutBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = XInBtn
AnchorSideTop.Side = asrBottom
Left = 204
Height = 28
Top = 49
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = XOutBtnClick
Spacing = 0
object ComputeBtn: TButton
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom
Left = 157
Height = 25
Top = 459
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 2
end
object YInBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideBottom.Control = Bevel1
Left = 204
Height = 28
Top = 133
Width = 28
Anchors = [akLeft, akBottom]
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = YInBtnClick
Spacing = 0
object ResetBtn: TButton
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom
Left = 95
Height = 25
Top = 459
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 3
end
object Bevel2: TBevel
AnchorSideLeft.Control = ParamsPanel
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 443
Width = 296
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object HelpBtn: TButton
Tag = 161
AnchorSideRight.Control = ResetBtn
AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom
Left = 36
Height = 25
Top = 459
Width = 51
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 4
end
object YOutBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Bevel1
AnchorSideTop.Side = asrBottom
Left = 204
Height = 28
Top = 165
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = YOutBtnClick
Spacing = 0
object GroupBox1: TGroupBox
AnchorSideLeft.Control = ParamsPanel
AnchorSideBottom.Control = Bevel2
Left = 0
Height = 51
Top = 384
Width = 185
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Bottom = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 24
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsScaleChilds
ChildSizing.EnlargeVertical = crsScaleChilds
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 31
ClientWidth = 181
TabOrder = 5
object LinesBox: TCheckBox
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Top = 6
Width = 157
BorderSpacing.Left = 12
BorderSpacing.Top = 2
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
Caption = 'Connect Points with Lines'
TabOrder = 0
end
end
object Label2: TLabel
AnchorSideLeft.Control = XEdit
AnchorSideBottom.Control = XEdit
Left = 240
object Label4: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = PlotTitleEdit
AnchorSideTop.Side = asrCenter
Left = 8
Height = 15
Top = 25
Width = 54
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'X Variable:'
Top = 357
Width = 49
Caption = 'Plot Title:'
ParentColor = False
end
object Label3: TLabel
AnchorSideLeft.Control = YBox
AnchorSideBottom.Control = YBox
Left = 240
Height = 15
Top = 95
Width = 64
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Y Variable(s)'
ParentColor = False
end
object XEdit: TEdit
AnchorSideLeft.Control = XInBtn
object PlotTitleEdit: TEdit
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = XOutBtn
AnchorSideBottom.Side = asrBottom
Left = 240
AnchorSideBottom.Control = GroupBox1
Left = 65
Height = 23
Top = 42
Width = 196
Top = 353
Width = 231
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'XEdit'
end
object YBox: TListBox
AnchorSideLeft.Control = YInBtn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 240
Height = 102
Top = 112
Width = 196
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 6
end
object Bevel1: TBevel
AnchorSideTop.Control = YBox
AnchorSideTop.Side = asrCenter
Left = 210
Height = 4
Top = 161
Width = 14
Shape = bsSpacer
TextHint = 'Title above the chart'
end
end
object Memo1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 8
Height = 90
object ParamsSplitter: TSplitter
Left = 308
Height = 500
Top = 0
Width = 5
ResizeStyle = rsPattern
end
object PageControl1: TPageControl
Left = 317
Height = 484
Top = 8
Width = 436
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = 'Directions: '#13#10'1. Select the X variable common to all of the Y variables to be selected.'#13#10'2. Select the Y variables.'#13#10'3. Enter a label for the plot.'#13#10'4. Select the options desired.'#13#10'5. Click the Compute button to obtain results.'
ParentColor = False
end
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 385
Height = 25
Top = 434
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
OnClick = CloseBtnClick
TabOrder = 3
end
object ComputeBtn: TButton
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 297
Height = 25
Top = 434
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 4
end
object ResetBtn: TButton
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 235
Height = 25
Top = 434
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 12
Width = 675
ActivePage = ReportPage
Align = alClient
BorderSpacing.Left = 4
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 5
end
object Bevel2: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 418
Width = 452
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object HelpBtn: TButton
Tag = 161
AnchorSideRight.Control = ResetBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 172
Height = 25
Top = 434
Width = 51
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 12
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 6
TabIndex = 0
TabOrder = 2
object ReportPage: TTabSheet
Caption = 'Report'
end
object ChartPage: TTabSheet
Caption = 'Chart'
end
end
end

View File

@ -3,33 +3,35 @@
unit XvsMultYUnit;
{$MODE objfpc}{$H+}
{$I ../../../LazStats.inc}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, Printers,
MainUnit, Globals, ContextHelpUnit, OutputUnit, DataProcs, MatrixLib;
StdCtrls, Buttons, ExtCtrls, Printers, ComCtrls,
MainUnit, Globals, ContextHelpUnit, DataProcs, MatrixLib,
ReportFrameUnit, ChartFrameUnit;
type
{ TXvsMultYForm }
TXvsMultYForm = class(TForm)
Bevel1: TBevel;
Bevel2: TBevel;
LinesBox: TCheckBox;
DescChk: TCheckBox;
GroupBox1: TGroupBox;
Memo1: TLabel;
PageControl1: TPageControl;
Panel1: TPanel;
ParamsPanel: TPanel;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
PlotTitleEdit: TEdit;
Label4: TLabel;
HelpBtn: TButton;
ParamsSplitter: TSplitter;
ReportPage: TTabSheet;
ChartPage: TTabSheet;
YBox: TListBox;
XEdit: TEdit;
Label2: TLabel;
@ -46,6 +48,7 @@ type
procedure FormCreate(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure VarListDblClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; User: boolean);
procedure XInBtnClick(Sender: TObject);
procedure XOutBtnClick(Sender: TObject);
@ -53,14 +56,11 @@ type
procedure YOutBtnClick(Sender: TObject);
private
{ private declarations }
FReportFrame: TReportFrame;
FChartFrame: TChartFrame;
FAutoSized: Boolean;
selected: IntDyneVec;
{$IFDEF USE_TACHART}
procedure PlotXY(XValues: DblDyneVec; YValues: DblDyneMat);
{$ELSE}
procedure PlotXY(XValues: DblDyneVec; YValues: DblDyneMat;
MaxX, MinX, MaxY, MinY: double; N, NoY: integer);
{$ENDIF}
procedure UpdateBtnStates;
public
{ public declarations }
@ -70,50 +70,27 @@ type
var
XvsMultYForm: TXvsMultYForm;
implementation
{$R *.lfm}
uses
{$IFDEF USE_TACHART}
TAChartUtils,
ChartFrameUnit, ChartUnit,
{$ELSE}
BlankFrmUnit,
{$ENDIF}
Math, Utils;
{ TXvsMultYForm }
procedure TXvsMultYForm.Reset;
var
i: integer;
procedure TXvsMultYForm.CloseBtnClick(Sender: TObject);
begin
VarList.Clear;
YBox.Clear;
XEdit.Clear;
XInBtn.Enabled := true;
XOutBtn.Enabled := false;
YInBtn.Enabled := true;
YOutBtn.Enabled := false;
PlotTitleEdit.Text := '';
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
Close;
end;
procedure TXvsMultYForm.ResetBtnClick(Sender: TObject);
begin
Reset;
end;
procedure TXvsMultYForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
procedure TXvsMultYForm.ComputeBtnClick(Sender: TObject);
var
i, j, k, N, NoY, XCol, NoSelected: integer;
i, j, N, NoY, XCol, NoSelected: integer;
MinX, MaxX, MinY, MaxY: double;
Title: string;
RMatrix: DblDyneMat = nil;
@ -216,30 +193,27 @@ begin
end;
// get descriptive data
if DescChk.Checked then
begin
lReport.Add('X VERSUS MULTIPLE Y VALUES PLOT');
lReport.Add('');
lReport.Add('X VERSUS MULTIPLE Y VALUES PLOT');
lReport.Add('');
Correlations(NoSelected,selected,RMatrix,Means,Variances,StdDevs,errorcode,Ncases);
//N := Ncases;
Title := 'CORRELATIONS';
MatPrint(RMatrix, NoSelected, NoSelected, Title, RowLabels, ColLabels, N, lReport);
Title := 'Means';
DynVectorPrint(Means, NoSelected, Title, RowLabels, N, lReport);
Title := 'Variances';
DynVectorPrint(Variances, NoSelected, Title, RowLabels, N, lReport);
Title := 'Standard Deviations';
DynVectorPrint(StdDevs, NoSelected, Title, RowLabels, N, lReport);
Correlations(NoSelected,selected,RMatrix,Means,Variances,StdDevs,errorcode,Ncases);
//N := Ncases;
Title := 'CORRELATIONS';
MatPrint(RMatrix, NoSelected, NoSelected, Title, RowLabels, ColLabels, N, lReport);
Title := 'Means';
DynVectorPrint(Means, NoSelected, Title, RowLabels, N, lReport);
Title := 'Variances';
DynVectorPrint(Variances, NoSelected, Title, RowLabels, N, lReport);
Title := 'Standard Deviations';
DynVectorPrint(StdDevs, NoSelected, Title, RowLabels, N, lReport);
DisplayReport(lReport);
end;
FReportFrame.DisplayReport(lReport);
// Sort on X
SortOnX(XValues, YValues);
// Plot x vs multiple y
PlotXY(XValues, YValues{$IFNDEF USE_TACHART}, MaxX, MinX, MaxY, MinY, N, NoY{$ENDIF});
PlotXY(XValues, YValues);
finally
lReport.Free;
@ -256,12 +230,6 @@ begin
end;
procedure TXvsMultYForm.CloseBtnClick(Sender: TObject);
begin
Close;
end;
procedure TXvsMultYForm.FormActivate(Sender: TObject);
var
w: Integer;
@ -275,8 +243,16 @@ begin
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
Constraints.MinWidth := Width;
Constraints.MinHeight := Height;
Panel1.Constraints.MinHeight := YOutBtn.Top + YOutBtn.Height;
ParamsPanel.Constraints.MinWidth := 4*w + 3*CloseBtn.BorderSpacing.Left;
ParamsPanel.Constraints.MinHeight := Panel1.Constraints.MinHeight + Panel1.BorderSpacing.Bottom +
PlotTitleEdit.Height + GroupBox1.Height + 2*GroupBox1.BorderSpacing.Top +
Bevel2.Height + CloseBtn.Height + CloseBtn.BorderSpacing.Top;
Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + 2*ParamsPanel.BorderSpacing.Top;
Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 200;
if Height < Constraints.MinHeight then Height := 1; // enforce autosizing if needed
if Width < Constraints.MinWidth then Width :=1;
Position := poDesigned;
FAutoSized := true;
@ -286,6 +262,20 @@ end;
procedure TXvsMultYForm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
Width := Scale96ToFont(DEFAULT_WIDTH);
Height := Scale96ToFont(DEFAULT_HEIGHT);
FReportFrame := TReportFrame.Create(self);
FReportFrame.Parent := ReportPage;
FReportFrame.Align := alClient;
FChartFrame := TChartFrame.Create(self);
FChartFrame.Parent := ChartPage;
FChartFrame.Align := alClient;
FChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80;
FChartFrame.Chart.BottomAxis.Intervals.MinLength := 30;
Reset;
end;
@ -298,6 +288,95 @@ begin
end;
// Routine to plot X versus multiple Y values
// Unlike many other routines in LazStats the curve index in YValues is the
// first one, the point index is the second one.
procedure TXvsMultYForm.PlotXY(XValues: DblDyneVec; YValues: DblDyneMat);
var
N, Ny, Nc: Integer;
j: Integer;
pt: TPlotType;
begin
// Preparations
if LinesBox.Checked then pt := ptLinesAndSymbols else pt := ptSymbols;
N := Length(XValues);
Ny := Length(YValues);
Nc := Length(DATA_COLORS);
FChartFrame.Clear;
// Titles
FChartFrame.SetTitle(PlotTitleEdit.Text);
FChartFrame.SetXTitle(XEdit.Text);
FChartFrame.SetYTitle('Y Values');
// Plot a series for each y value
for j := 0 to Ny - 1 do
FChartFrame.PlotXY(pt, XValues, YValues[j], nil, nil, Trim(YBox.Items[j]), DATA_COLORS[j mod Nc]);
end;
procedure TXvsMultYForm.Reset;
var
i: integer;
begin
VarList.Clear;
YBox.Clear;
XEdit.Clear;
XInBtn.Enabled := true;
XOutBtn.Enabled := false;
YInBtn.Enabled := true;
YOutBtn.Enabled := false;
PlotTitleEdit.Text := '';
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
end;
procedure TXvsMultYForm.ResetBtnClick(Sender: TObject);
begin
Reset;
end;
procedure TXvsMultYForm.UpdateBtnStates;
var
lSelected: Boolean;
begin
lSelected := AnySelected(VarList);
XInBtn.Enabled := lSelected and (XEdit.Text = '');
YInBtn.Enabled := lSelected;
xOutBtn.Enabled := (XEdit.Text <> '');
YOutBtn.Enabled := AnySelected(YBox);
FReportFrame.UpdateBtnStates;
FChartFrame.UpdateBtnStates;
end;
procedure TXvsMultYForm.VarListDblClick(Sender: TObject);
var
index: integer;
begin
index := VarList.ItemIndex;
if index > -1 then
begin
if XEdit.Text = '' then
XEdit.Text := VarList.Items[index]
else
YBox.Items.Add(VarList.Items[index]);
VarList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TXvsMultYForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
procedure TXvsMultYForm.XInBtnClick(Sender: TObject);
var
index: integer;
@ -361,170 +440,5 @@ begin
end;
// Routine to plot X versus multiple Y values
// Unlike many other routines in LazStats the curve index in YValues is the
// first one, the point index is the second one.
{$IFDEF USE_TACHART}
procedure TXvsMultYForm.PlotXY(XValues: DblDyneVec; YValues: DblDyneMat);
var
N, Ny, Nc: Integer;
j: Integer;
pt: TPlotType;
begin
// Preparations
if LinesBox.Checked then pt := ptLinesAndSymbols else pt := ptSymbols;
N := Length(XValues);
Ny := Length(YValues);
Nc := Length(DATA_COLORS);
if ChartForm = nil then
ChartForm := TChartForm.Create(Application)
else
ChartForm.Clear;
// Titles
ChartForm.SetTitle(PlotTitleEdit.Text);
ChartForm.SetXTitle(XEdit.Text);
ChartForm.SetYTitle('Y Values');
// Plot a series for each y value
for j := 0 to Ny - 1 do
ChartForm.PlotXY(pt, XValues, YValues[j], nil, nil, Trim(YBox.Items[j]), DATA_COLORS[j mod Nc]);
// Show chart
ChartForm.ShowModal;
end;
{$ELSE}
procedure TXvsMultYForm.PlotXY(XValues: DblDyneVec; YValues: DblDyneMat;
MaxX, MinX, MaxY, MinY: double; N, NoY: integer);
var
i, j, xpos, ypos, hleft, hright, vtop, vbottom, imagewide: integer;
vhi, hwide, offset, strhi, imagehi: integer;
valincr, Yvalue, Xvalue: double;
Title: string;
begin
if BlankFrm = nil then
Application.CreateForm(TBlankFrm, BlankFrm);
BlankFrm.Caption := PlotTitleEdit.Text;
BlankFrm.Show;
imagewide := BlankFrm.Image1.Width;
imagehi := BlankFrm.Image1.Height;
vtop := 40;
vbottom := round(imagehi) - 60;
vhi := vbottom - vtop;
hleft := 100;
hright := imagewide - 80;
hwide := hright - hleft;
// Draw chart border and background
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
BlankFrm.Image1.Canvas.Rectangle(0, 0, imagewide, imagehi);
// Draw title
Title := PlotTitleEdit.Text;
if Title <> '' then
begin
xpos := (imagewide - BlankFrm.Image1.Canvas.TextWidth(Title)) div 2;
yPos := 2;
BlankFrm.Image1.Canvas.TextOut(xpos, ypos, Title);
end;
// draw horizontal axis
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.MoveTo(hleft,vbottom);
BlankFrm.Image1.Canvas.LineTo(hright,vbottom);
valincr := (maxX - minX) / 10.0;
for i := 1 to 11 do
begin
ypos := vbottom;
Xvalue := minX + valincr * (i - 1);
xpos := hleft + round(hwide * ((Xvalue - minX) / (maxX - minX)));
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
ypos := ypos + 10;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
Title := Format('%.2f', [Xvalue]);
offset := BlankFrm.Image1.Canvas.TextWidth(Title) div 2;
xpos := xpos - offset;
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.TextOut(xpos, ypos, Title);
end;
xpos := hleft + (hwide - BlankFrm.Image1.Canvas.TextWidth(XEdit.Text)) div 2;
ypos := vbottom + 30;
BlankFrm.Image1.Canvas.TextOut(xpos, ypos, XEdit.Text);
// draw vertical axis
Title := 'Y VALUES';
xpos := hleft - BlankFrm.Image1.Canvas.TextWidth(Title) div 2;
ypos := 8;
BlankFrm.Image1.Canvas.TextOut(xpos, ypos, Title);
xpos := hleft;
ypos := vtop;
BlankFrm.Image1.Canvas.MoveTo(xpos, ypos);
ypos := vbottom;
BlankFrm.Image1.Canvas.LineTo(xpos, ypos);
valincr := (maxY - minY) / 10.0;
for i := 1 to 11 do
begin
Title := Format('%.2f',[maxY - ((i-1)*valincr)]);
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
xpos := hleft - 20 - BlankFrm.Image1.Canvas.TextWidth(Title);
Yvalue := maxY - (valincr * (i-1));
ypos := round(vhi * ( (maxY - Yvalue) / (maxY - minY)));
ypos := ypos + vtop - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos, ypos, Title);
xpos := hleft;
ypos := ypos + strhi div 2;
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
xpos := hleft - 10;
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
end;
// draw points for x and y pairs
for j := 0 to NoY-1 do
begin
BlankFrm.Image1.Canvas.Brush.Style := bsSolid;
BlankFrm.Image1.Canvas.Brush.Color := DATA_COLORS[j mod Length(DATA_COLORS)];
BlankFrm.Image1.Canvas.Pen.Color := DATA_COLORS[j mod Length(DATA_COLORS)];
BlankFrm.Image1.Canvas.Font.Color := DATA_COLORS[j mod Length(DATA_COLORS)];
Title := Trim(OS3MainFrm.DataGrid.Cells[selected[j],0]);
for i := 0 to N-1 do
begin
ypos := vtop + round(vhi * ( (maxY - YValues[j, i]) / (maxY - minY)));
xpos := hleft + round(hwide * ( (XValues[i] - minX) / (maxX - minX)));
if xpos < hleft then xpos := hleft;
if i = 0 then
BlankFrm.Image1.Canvas.MoveTo(xpos, ypos);
if LinesBox.Checked then
BlankFrm.Image1.Canvas.LineTo(xpos, ypos);
BlankFrm.Image1.Canvas.Ellipse(xpos, ypos, xpos+5, ypos+5);
end;
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
xpos := hwide + hleft;
BlankFrm.Image1.Canvas.MoveTo(xpos, ypos-strhi);
BlankFrm.Image1.Canvas.TextOut(xpos, ypos, Title);
end;
BlankFrm.Image1.Canvas.Font.Color := clBlack;
end;
{$ENDIF}
procedure TXvsMultYForm.UpdateBtnStates;
var
lSelected: Boolean;
begin
lSelected := AnySelected(VarList);
XInBtn.Enabled := lSelected and (XEdit.Text = '');
YInBtn.Enabled := lSelected;
xOutBtn.Enabled := (XEdit.Text <> '');
YOutBtn.Enabled := AnySelected(YBox);
end;
end.

View File

@ -171,6 +171,9 @@ procedure TBasicSPCForm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
Width := Scale96ToFont(DEFAULT_WIDTH);
Height := Scale96ToFont(DEFAULT_HEIGHT);
FReportFrame := TReportFrame.Create(self);
FReportFrame.Parent := ReportPage;
FReportFrame.Align := alClient;

View File

@ -95,6 +95,9 @@ const
CSV_FILE_FILTER = 'Comma field files (*.csv)|*.csv;*.CSV|Text files (*.txt)|*.txt;*.TXT|All files (*.*)|*.*';
SSV_FILE_FILTER = 'Space field files (*.ssv)|*.ssv;*.SSV|Text files (*.txt)|*.txt;*.TXT|All files (*.*)|*.*';
DEFAULT_WIDTH = 1000;
DEFAULT_HEIGHT = 500;
implementation
end.