You've already forked lazarus-ccr
LazStats: Integrate report and chart into PlotXYUnit's form.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7678 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,340 +1,350 @@
|
|||||||
object PlotXYFrm: TPlotXYFrm
|
object PlotXYFrm: TPlotXYFrm
|
||||||
Left = 433
|
Left = 522
|
||||||
Height = 374
|
Height = 348
|
||||||
Top = 262
|
Top = 172
|
||||||
Width = 490
|
Width = 847
|
||||||
HelpType = htKeyword
|
HelpType = htKeyword
|
||||||
HelpKeyword = 'html/XVersusYPlot.htm'
|
HelpKeyword = 'html/XVersusYPlot.htm'
|
||||||
AutoSize = True
|
|
||||||
Caption = 'Plot X versus Y'
|
Caption = 'Plot X versus Y'
|
||||||
ClientHeight = 374
|
ClientHeight = 348
|
||||||
ClientWidth = 490
|
ClientWidth = 847
|
||||||
OnActivate = FormActivate
|
OnActivate = FormActivate
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
Position = poMainFormCenter
|
Position = poMainFormCenter
|
||||||
LCLVersion = '2.1.0.0'
|
LCLVersion = '2.1.0.0'
|
||||||
object Label1: TLabel
|
object ParamsPanel: TPanel
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideTop.Control = Owner
|
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 15
|
Height = 332
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 46
|
Width = 376
|
||||||
BorderSpacing.Left = 8
|
Align = alLeft
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Around = 8
|
||||||
Caption = 'Variables'
|
BevelOuter = bvNone
|
||||||
ParentColor = False
|
ClientHeight = 332
|
||||||
end
|
ClientWidth = 376
|
||||||
object Label2: TLabel
|
|
||||||
AnchorSideLeft.Control = XEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = XEdit
|
|
||||||
Left = 267
|
|
||||||
Height = 15
|
|
||||||
Top = 31
|
|
||||||
Width = 76
|
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
BorderSpacing.Bottom = 2
|
|
||||||
Caption = 'X Axis Variable'
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object Label3: TLabel
|
|
||||||
AnchorSideLeft.Control = YEdit
|
|
||||||
AnchorSideBottom.Control = YEdit
|
|
||||||
Left = 267
|
|
||||||
Height = 15
|
|
||||||
Top = 117
|
|
||||||
Width = 76
|
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
BorderSpacing.Bottom = 2
|
|
||||||
Caption = 'Y Axis Variable'
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object VarList: TListBox
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideTop.Control = Label1
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = XinBtn
|
|
||||||
AnchorSideBottom.Control = Bevel1
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 8
|
|
||||||
Height = 300
|
|
||||||
Top = 25
|
|
||||||
Width = 215
|
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 2
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
ItemHeight = 0
|
|
||||||
OnSelectionChange = VarListSelectionChange
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
object CloseBtn: TButton
|
||||||
object XinBtn: TBitBtn
|
AnchorSideRight.Control = ParamsPanel
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideLeft.Side = asrCenter
|
AnchorSideBottom.Control = ParamsPanel
|
||||||
AnchorSideTop.Control = VarList
|
AnchorSideBottom.Side = asrBottom
|
||||||
AnchorSideRight.Control = XEdit
|
Left = 314
|
||||||
Left = 231
|
Height = 25
|
||||||
Height = 28
|
Top = 307
|
||||||
Top = 25
|
Width = 62
|
||||||
Width = 28
|
Anchors = [akRight, akBottom]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Top = 8
|
||||||
Images = MainDataModule.ImageList
|
Caption = 'Close'
|
||||||
ImageIndex = 1
|
ModalResult = 11
|
||||||
OnClick = XinBtnClick
|
OnClick = CloseBtnClick
|
||||||
Spacing = 0
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
object XOutBtn: TBitBtn
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideLeft.Side = asrCenter
|
|
||||||
AnchorSideTop.Control = XinBtn
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 231
|
|
||||||
Height = 28
|
|
||||||
Top = 57
|
|
||||||
Width = 28
|
|
||||||
BorderSpacing.Top = 4
|
|
||||||
Images = MainDataModule.ImageList
|
|
||||||
ImageIndex = 0
|
|
||||||
OnClick = XOutBtnClick
|
|
||||||
Spacing = 0
|
|
||||||
TabOrder = 2
|
|
||||||
end
|
|
||||||
object YInBtn: TBitBtn
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideLeft.Side = asrCenter
|
|
||||||
AnchorSideTop.Control = XOutBtn
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = YOutBtn
|
|
||||||
Left = 231
|
|
||||||
Height = 28
|
|
||||||
Top = 109
|
|
||||||
Width = 28
|
|
||||||
BorderSpacing.Top = 24
|
|
||||||
BorderSpacing.Bottom = 4
|
|
||||||
Images = MainDataModule.ImageList
|
|
||||||
ImageIndex = 1
|
|
||||||
OnClick = YInBtnClick
|
|
||||||
Spacing = 0
|
|
||||||
TabOrder = 3
|
|
||||||
end
|
|
||||||
object YOutBtn: TBitBtn
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideLeft.Side = asrCenter
|
|
||||||
AnchorSideTop.Control = YInBtn
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = VarList
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 231
|
|
||||||
Height = 28
|
|
||||||
Top = 141
|
|
||||||
Width = 28
|
|
||||||
BorderSpacing.Top = 4
|
|
||||||
Images = MainDataModule.ImageList
|
|
||||||
ImageIndex = 0
|
|
||||||
OnClick = YOutBtnClick
|
|
||||||
Spacing = 0
|
|
||||||
TabOrder = 4
|
|
||||||
end
|
|
||||||
object XEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = XinBtn
|
|
||||||
AnchorSideLeft.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = XOutBtn
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 267
|
|
||||||
Height = 23
|
|
||||||
Top = 50
|
|
||||||
Width = 215
|
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 4
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
BorderSpacing.Bottom = 12
|
|
||||||
ReadOnly = True
|
|
||||||
TabOrder = 5
|
|
||||||
Text = 'XEdit'
|
|
||||||
end
|
|
||||||
object YEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = XEdit
|
|
||||||
AnchorSideRight.Control = XEdit
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = YOutBtn
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 267
|
|
||||||
Height = 23
|
|
||||||
Top = 134
|
|
||||||
Width = 215
|
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
|
||||||
BorderSpacing.Bottom = 12
|
|
||||||
ReadOnly = True
|
|
||||||
TabOrder = 6
|
|
||||||
Text = 'YEdit'
|
|
||||||
end
|
|
||||||
object GroupBox1: TGroupBox
|
|
||||||
AnchorSideLeft.Control = XinBtn
|
|
||||||
AnchorSideTop.Control = YEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 231
|
|
||||||
Height = 141
|
|
||||||
Top = 181
|
|
||||||
Width = 191
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Top = 24
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
Caption = 'Options'
|
|
||||||
ChildSizing.LeftRightSpacing = 12
|
|
||||||
ClientHeight = 121
|
|
||||||
ClientWidth = 187
|
|
||||||
TabOrder = 7
|
|
||||||
object Label4: TLabel
|
|
||||||
AnchorSideLeft.Control = ConfChk
|
|
||||||
AnchorSideTop.Control = ConfEdit
|
|
||||||
AnchorSideTop.Side = asrCenter
|
|
||||||
Left = 36
|
|
||||||
Height = 15
|
|
||||||
Top = 94
|
|
||||||
Width = 74
|
|
||||||
BorderSpacing.Left = 24
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
Caption = '% Confidence'
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object DescChk: TCheckBox
|
|
||||||
AnchorSideLeft.Control = GroupBox1
|
|
||||||
AnchorSideTop.Control = GroupBox1
|
|
||||||
Left = 12
|
|
||||||
Height = 19
|
|
||||||
Top = 2
|
|
||||||
Width = 155
|
|
||||||
BorderSpacing.Left = 12
|
|
||||||
BorderSpacing.Top = 2
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
Caption = 'Print Descriptive Statistics'
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object ConfEdit: TEdit
|
object ComputeBtn: TButton
|
||||||
AnchorSideLeft.Control = Label4
|
AnchorSideRight.Control = CloseBtn
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideBottom.Control = ParamsPanel
|
||||||
AnchorSideTop.Control = ConfChk
|
AnchorSideBottom.Side = asrBottom
|
||||||
AnchorSideTop.Side = asrBottom
|
Left = 230
|
||||||
Left = 118
|
Height = 25
|
||||||
Height = 23
|
Top = 307
|
||||||
Top = 90
|
Width = 76
|
||||||
Width = 57
|
Anchors = [akRight, akBottom]
|
||||||
Alignment = taRightJustify
|
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Top = 8
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
BorderSpacing.Bottom = 8
|
Caption = 'Compute'
|
||||||
|
OnClick = ComputeBtnClick
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
Text = '95.0'
|
|
||||||
end
|
end
|
||||||
object LineChk: TCheckBox
|
object ResetBtn: TButton
|
||||||
AnchorSideLeft.Control = DescChk
|
AnchorSideRight.Control = ComputeBtn
|
||||||
AnchorSideTop.Control = DescChk
|
AnchorSideBottom.Control = ParamsPanel
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 12
|
Left = 168
|
||||||
Height = 19
|
Height = 25
|
||||||
Top = 25
|
Top = 307
|
||||||
Width = 146
|
Width = 54
|
||||||
BorderSpacing.Top = 4
|
Anchors = [akRight, akBottom]
|
||||||
Caption = 'Plot the Regression Line'
|
BorderSpacing.Left = 12
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
Caption = 'Reset'
|
||||||
|
OnClick = ResetBtnClick
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object MeansChk: TCheckBox
|
object Bevel1: TBevel
|
||||||
AnchorSideLeft.Control = LineChk
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideTop.Control = LineChk
|
AnchorSideRight.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = CloseBtn
|
||||||
|
Left = 0
|
||||||
|
Height = 8
|
||||||
|
Top = 291
|
||||||
|
Width = 376
|
||||||
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
|
Shape = bsBottomLine
|
||||||
|
end
|
||||||
|
object Label1: TLabel
|
||||||
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
|
AnchorSideTop.Control = ParamsPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 15
|
||||||
|
Top = 0
|
||||||
|
Width = 46
|
||||||
|
Caption = 'Variables'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object VarList: TListBox
|
||||||
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
|
AnchorSideTop.Control = Label1
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 12
|
AnchorSideRight.Control = XinBtn
|
||||||
Height = 19
|
AnchorSideBottom.Control = Bevel1
|
||||||
Top = 48
|
AnchorSideBottom.Side = asrBottom
|
||||||
Width = 99
|
Left = 0
|
||||||
BorderSpacing.Top = 4
|
Height = 274
|
||||||
Caption = 'Plot the Means'
|
Top = 17
|
||||||
|
Width = 166
|
||||||
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
BorderSpacing.Top = 2
|
||||||
|
BorderSpacing.Bottom = 8
|
||||||
|
ItemHeight = 0
|
||||||
|
OnSelectionChange = VarListSelectionChange
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
end
|
end
|
||||||
object ConfChk: TCheckBox
|
object Label2: TLabel
|
||||||
AnchorSideLeft.Control = MeansChk
|
AnchorSideLeft.Control = XEdit
|
||||||
AnchorSideTop.Control = MeansChk
|
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 12
|
AnchorSideBottom.Control = XEdit
|
||||||
Height = 19
|
Left = 210
|
||||||
Top = 71
|
Height = 15
|
||||||
Width = 155
|
Top = 23
|
||||||
BorderSpacing.Top = 4
|
Width = 76
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
|
BorderSpacing.Bottom = 2
|
||||||
|
Caption = 'X Axis Variable'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object Label3: TLabel
|
||||||
|
AnchorSideLeft.Control = YEdit
|
||||||
|
AnchorSideBottom.Control = YEdit
|
||||||
|
Left = 210
|
||||||
|
Height = 15
|
||||||
|
Top = 109
|
||||||
|
Width = 76
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
|
BorderSpacing.Bottom = 2
|
||||||
|
Caption = 'Y Axis Variable'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object XinBtn: TBitBtn
|
||||||
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
|
AnchorSideLeft.Side = asrCenter
|
||||||
|
AnchorSideTop.Control = VarList
|
||||||
|
Left = 174
|
||||||
|
Height = 28
|
||||||
|
Top = 17
|
||||||
|
Width = 28
|
||||||
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
Caption = 'Plot the Confidence Band'
|
Images = MainDataModule.ImageList
|
||||||
|
ImageIndex = 1
|
||||||
|
OnClick = XinBtnClick
|
||||||
|
Spacing = 0
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
end
|
end
|
||||||
|
object XOutBtn: TBitBtn
|
||||||
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
|
AnchorSideLeft.Side = asrCenter
|
||||||
|
AnchorSideTop.Control = XinBtn
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 174
|
||||||
|
Height = 28
|
||||||
|
Top = 49
|
||||||
|
Width = 28
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
Images = MainDataModule.ImageList
|
||||||
|
ImageIndex = 0
|
||||||
|
OnClick = XOutBtnClick
|
||||||
|
Spacing = 0
|
||||||
|
TabOrder = 5
|
||||||
|
end
|
||||||
|
object YInBtn: TBitBtn
|
||||||
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
|
AnchorSideLeft.Side = asrCenter
|
||||||
|
AnchorSideTop.Control = XOutBtn
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = YOutBtn
|
||||||
|
Left = 174
|
||||||
|
Height = 28
|
||||||
|
Top = 101
|
||||||
|
Width = 28
|
||||||
|
BorderSpacing.Top = 24
|
||||||
|
BorderSpacing.Bottom = 4
|
||||||
|
Images = MainDataModule.ImageList
|
||||||
|
ImageIndex = 1
|
||||||
|
OnClick = YInBtnClick
|
||||||
|
Spacing = 0
|
||||||
|
TabOrder = 6
|
||||||
|
end
|
||||||
|
object YOutBtn: TBitBtn
|
||||||
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
|
AnchorSideLeft.Side = asrCenter
|
||||||
|
AnchorSideTop.Control = YInBtn
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = VarList
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
|
Left = 174
|
||||||
|
Height = 28
|
||||||
|
Top = 133
|
||||||
|
Width = 28
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
Images = MainDataModule.ImageList
|
||||||
|
ImageIndex = 0
|
||||||
|
OnClick = YOutBtnClick
|
||||||
|
Spacing = 0
|
||||||
|
TabOrder = 7
|
||||||
|
end
|
||||||
|
object XEdit: TEdit
|
||||||
|
AnchorSideLeft.Control = XinBtn
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = XOutBtn
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
|
Left = 210
|
||||||
|
Height = 23
|
||||||
|
Top = 42
|
||||||
|
Width = 158
|
||||||
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
BorderSpacing.Bottom = 12
|
||||||
|
ReadOnly = True
|
||||||
|
TabOrder = 8
|
||||||
|
Text = 'XEdit'
|
||||||
|
end
|
||||||
|
object YEdit: TEdit
|
||||||
|
AnchorSideLeft.Control = XEdit
|
||||||
|
AnchorSideRight.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = YOutBtn
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
|
Left = 210
|
||||||
|
Height = 23
|
||||||
|
Top = 126
|
||||||
|
Width = 166
|
||||||
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
|
BorderSpacing.Bottom = 12
|
||||||
|
ReadOnly = True
|
||||||
|
TabOrder = 9
|
||||||
|
Text = 'YEdit'
|
||||||
|
end
|
||||||
|
object OptionsGroup: TGroupBox
|
||||||
|
AnchorSideLeft.Control = XinBtn
|
||||||
|
AnchorSideTop.Control = YEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 174
|
||||||
|
Height = 120
|
||||||
|
Top = 173
|
||||||
|
Width = 191
|
||||||
|
AutoSize = True
|
||||||
|
BorderSpacing.Top = 24
|
||||||
|
Caption = 'Options'
|
||||||
|
ChildSizing.LeftRightSpacing = 12
|
||||||
|
ClientHeight = 100
|
||||||
|
ClientWidth = 187
|
||||||
|
TabOrder = 10
|
||||||
|
object Label4: TLabel
|
||||||
|
AnchorSideLeft.Control = ConfChk
|
||||||
|
AnchorSideTop.Control = ConfEdit
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 36
|
||||||
|
Height = 15
|
||||||
|
Top = 73
|
||||||
|
Width = 74
|
||||||
|
BorderSpacing.Left = 24
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
Caption = '% Confidence'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object ConfEdit: TEdit
|
||||||
|
AnchorSideLeft.Control = Label4
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = ConfChk
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 118
|
||||||
|
Height = 23
|
||||||
|
Top = 69
|
||||||
|
Width = 57
|
||||||
|
Alignment = taRightJustify
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
BorderSpacing.Bottom = 8
|
||||||
|
TabOrder = 0
|
||||||
|
Text = '95.0'
|
||||||
|
end
|
||||||
|
object LineChk: TCheckBox
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 12
|
||||||
|
Height = 19
|
||||||
|
Top = 4
|
||||||
|
Width = 146
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
Caption = 'Plot the Regression Line'
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object MeansChk: TCheckBox
|
||||||
|
AnchorSideLeft.Control = LineChk
|
||||||
|
AnchorSideTop.Control = LineChk
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 12
|
||||||
|
Height = 19
|
||||||
|
Top = 27
|
||||||
|
Width = 99
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
Caption = 'Plot the Means'
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
object ConfChk: TCheckBox
|
||||||
|
AnchorSideLeft.Control = MeansChk
|
||||||
|
AnchorSideTop.Control = MeansChk
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 12
|
||||||
|
Height = 19
|
||||||
|
Top = 50
|
||||||
|
Width = 155
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
Caption = 'Plot the Confidence Band'
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object CloseBtn: TButton
|
object ParamsSplitter: TSplitter
|
||||||
AnchorSideRight.Control = Owner
|
Left = 392
|
||||||
AnchorSideRight.Side = asrBottom
|
Height = 348
|
||||||
AnchorSideBottom.Control = Owner
|
Top = 0
|
||||||
AnchorSideBottom.Side = asrBottom
|
Width = 5
|
||||||
Left = 416
|
ResizeStyle = rsPattern
|
||||||
Height = 25
|
|
||||||
Top = 341
|
|
||||||
Width = 62
|
|
||||||
Anchors = [akRight, akBottom]
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 12
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
Caption = 'Close'
|
|
||||||
ModalResult = 11
|
|
||||||
OnClick = CloseBtnClick
|
|
||||||
TabOrder = 8
|
|
||||||
end
|
end
|
||||||
object ComputeBtn: TButton
|
object PageControl1: TPageControl
|
||||||
AnchorSideRight.Control = CloseBtn
|
Left = 405
|
||||||
AnchorSideBottom.Control = Owner
|
Height = 332
|
||||||
AnchorSideBottom.Side = asrBottom
|
Top = 8
|
||||||
Left = 332
|
Width = 434
|
||||||
Height = 25
|
ActivePage = ChartPage
|
||||||
Top = 341
|
Align = alClient
|
||||||
Width = 76
|
BorderSpacing.Around = 8
|
||||||
Anchors = [akRight, akBottom]
|
TabIndex = 1
|
||||||
BorderSpacing.Left = 8
|
TabOrder = 2
|
||||||
BorderSpacing.Top = 8
|
object ReportPage: TTabSheet
|
||||||
BorderSpacing.Right = 8
|
Caption = 'Report'
|
||||||
BorderSpacing.Bottom = 8
|
end
|
||||||
Caption = 'Compute'
|
object ChartPage: TTabSheet
|
||||||
OnClick = ComputeBtnClick
|
Caption = 'Chart'
|
||||||
TabOrder = 9
|
end
|
||||||
end
|
|
||||||
object ResetBtn: TButton
|
|
||||||
AnchorSideRight.Control = ComputeBtn
|
|
||||||
AnchorSideBottom.Control = Owner
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 270
|
|
||||||
Height = 25
|
|
||||||
Top = 341
|
|
||||||
Width = 54
|
|
||||||
Anchors = [akRight, akBottom]
|
|
||||||
BorderSpacing.Left = 12
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
Caption = 'Reset'
|
|
||||||
OnClick = ResetBtnClick
|
|
||||||
TabOrder = 10
|
|
||||||
end
|
|
||||||
object Bevel1: TBevel
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = CloseBtn
|
|
||||||
Left = 0
|
|
||||||
Height = 8
|
|
||||||
Top = 325
|
|
||||||
Width = 490
|
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
|
||||||
Shape = bsBottomLine
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,14 +3,13 @@
|
|||||||
unit PlotXYUnit;
|
unit PlotXYUnit;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
{$I ../../../LazStats.inc}
|
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||||
StdCtrls, ExtCtrls, Buttons,
|
StdCtrls, ExtCtrls, Buttons, ComCtrls,
|
||||||
MainUnit, Globals, OutputUnit, FunctionsLib, DataProcs;
|
MainUnit, Globals, FunctionsLib, DataProcs, ReportFrameUnit, ChartFrameUnit;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -20,14 +19,18 @@ type
|
|||||||
Bevel1: TBevel;
|
Bevel1: TBevel;
|
||||||
ConfEdit: TEdit;
|
ConfEdit: TEdit;
|
||||||
Label4: TLabel;
|
Label4: TLabel;
|
||||||
|
PageControl1: TPageControl;
|
||||||
|
ParamsPanel: TPanel;
|
||||||
ResetBtn: TButton;
|
ResetBtn: TButton;
|
||||||
ComputeBtn: TButton;
|
ComputeBtn: TButton;
|
||||||
CloseBtn: TButton;
|
CloseBtn: TButton;
|
||||||
DescChk: TCheckBox;
|
|
||||||
LineChk: TCheckBox;
|
LineChk: TCheckBox;
|
||||||
MeansChk: TCheckBox;
|
MeansChk: TCheckBox;
|
||||||
ConfChk: TCheckBox;
|
ConfChk: TCheckBox;
|
||||||
GroupBox1: TGroupBox;
|
OptionsGroup: TGroupBox;
|
||||||
|
ParamsSplitter: TSplitter;
|
||||||
|
ReportPage: TTabSheet;
|
||||||
|
ChartPage: TTabSheet;
|
||||||
YEdit: TEdit;
|
YEdit: TEdit;
|
||||||
Label3: TLabel;
|
Label3: TLabel;
|
||||||
XEdit: TEdit;
|
XEdit: TEdit;
|
||||||
@ -51,14 +54,10 @@ type
|
|||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
FAutoSized: Boolean;
|
FAutoSized: Boolean;
|
||||||
{$IFDEF USE_TACHART}
|
FReportFrame: TReportFrame;
|
||||||
|
FChartFrame: TChartFrame;
|
||||||
function PlotXY(XPoints, YPoints, UpConf, LowConf: DblDyneVec;
|
function PlotXY(XPoints, YPoints, UpConf, LowConf: DblDyneVec;
|
||||||
XMean, YMean, R, Slope, Intercept: Double): Boolean;
|
XMean, YMean, R, Slope, Intercept: Double): Boolean;
|
||||||
{$ELSE}
|
|
||||||
function PlotXY(XPoints, YPoints, UpConf, LowConf: DblDyneVec;
|
|
||||||
XMean, YMean, R, Slope, Intercept, XMax, XMin, YMax, YMin: Double;
|
|
||||||
N: Integer): Boolean;
|
|
||||||
{$ENDIF}
|
|
||||||
procedure UpdateBtnStates;
|
procedure UpdateBtnStates;
|
||||||
function Validate(out AMsg: String; out AControl: TWinControl;
|
function Validate(out AMsg: String; out AControl: TWinControl;
|
||||||
Xcol,Ycol: Integer): Boolean;
|
Xcol,Ycol: Integer): Boolean;
|
||||||
@ -75,12 +74,7 @@ implementation
|
|||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF USE_TACHART}
|
TAChartUtils, TAChartAxisUtils, TALegend, TASources, TACustomSeries, TASeries,
|
||||||
TAChartUtils,
|
|
||||||
ChartFrameUnit, ChartUnit,
|
|
||||||
{$ELSE}
|
|
||||||
BlankFrmUnit,
|
|
||||||
{$ENDIF}
|
|
||||||
Math, Utils;
|
Math, Utils;
|
||||||
|
|
||||||
|
|
||||||
@ -93,13 +87,14 @@ begin
|
|||||||
XEdit.Text := '';
|
XEdit.Text := '';
|
||||||
YEdit.Text := '';
|
YEdit.Text := '';
|
||||||
ConfEdit.Text := FormatFloat('0.0', DEFAULT_CONFIDENCE_LEVEL_PERCENT);
|
ConfEdit.Text := FormatFloat('0.0', DEFAULT_CONFIDENCE_LEVEL_PERCENT);
|
||||||
DescChk.Checked := false;
|
|
||||||
LineChk.Checked := false;
|
LineChk.Checked := false;
|
||||||
MeansChk.Checked := false;
|
MeansChk.Checked := false;
|
||||||
ConfChk.Checked := false;
|
ConfChk.Checked := false;
|
||||||
VarList.Items.Clear;
|
VarList.Items.Clear;
|
||||||
for i := 1 to NoVariables do
|
for i := 1 to NoVariables do
|
||||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||||
|
FChartFrame.Clear;
|
||||||
|
FReportFrame.Clear;
|
||||||
UpdateBtnStates;
|
UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -260,28 +255,31 @@ begin
|
|||||||
Intercept := YMean - Slope * XMean;
|
Intercept := YMean - Slope * XMean;
|
||||||
|
|
||||||
// Now, print the descriptive statistics to the output form if requested
|
// Now, print the descriptive statistics to the output form if requested
|
||||||
if DescChk.Checked then
|
lReport := TStringList.Create;
|
||||||
begin
|
try
|
||||||
lReport := TStringList.Create;
|
lReport.Add('X vs. Y PLOT');
|
||||||
try
|
lReport.Add('');
|
||||||
lReport.Add('X vs. Y PLOT');
|
lReport.Add('Data file: %s', [OS3MainFrm.FileNameEdit.Text]);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
lReport.Add('X = %s, Y = %s from file: %s', [XEdit.Text, YEdit.Text, OS3MainFrm.FileNameEdit.Text]);
|
lReport.Add('Variables:');
|
||||||
lReport.Add('');
|
lReport.Add(' X: %s', [XEdit.Text]);
|
||||||
lReport.Add('Variable Mean Variance Std.Dev.');
|
lReport.Add(' Y: %s', [YEdit.Text]);
|
||||||
lReport.Add('%-10s%8.2f %8.2f %8.2f', [XEdit.Text, XMean, XVariance, XStdDev]);
|
lReport.Add('');
|
||||||
lReport.Add('%-10s%8.2f %8.2f %8.2f', [YEdit.Text, YMean, YVariance, YStdDev]);
|
lReport.Add('Variable Mean Variance Std.Dev.');
|
||||||
lReport.Add('');
|
lReport.Add('---------- -------- -------- --------');
|
||||||
lReport.Add('Correlation: %8.3f', [R]);
|
lReport.Add('%-10s %8.2f %8.2f %8.2f', [XEdit.Text, XMean, XVariance, XStdDev]);
|
||||||
lReport.Add('Slope: %8.3f', [Slope]);
|
lReport.Add('%-10s %8.2f %8.2f %8.2f', [YEdit.Text, YMean, YVariance, YStdDev]);
|
||||||
lReport.Add('Intercept: %8.3f', [Intercept]);
|
lReport.Add('');
|
||||||
lReport.Add('Standard Error of Estimate: %8.3f', [SEPred]);
|
lReport.Add('Regression:');
|
||||||
lReport.Add('Number of good cases: %8d', [N]);
|
lReport.Add(' Correlation: %8.3f', [R]);
|
||||||
|
lReport.Add(' Slope: %8.3f', [Slope]);
|
||||||
|
lReport.Add(' Intercept: %8.3f', [Intercept]);
|
||||||
|
lReport.Add(' Standard Error of Estimate: %8.3f', [SEPred]);
|
||||||
|
lReport.Add(' Number of good cases: %8d', [N]);
|
||||||
|
|
||||||
DisplayReport(lReport);
|
FReportFrame.DisplayReport(lReport);
|
||||||
finally
|
finally
|
||||||
lReport.Free;
|
lReport.Free;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Get upper and lower confidence points for each X value
|
// Get upper and lower confidence points for each X value
|
||||||
@ -305,10 +303,7 @@ begin
|
|||||||
ConfBand := 0.0;
|
ConfBand := 0.0;
|
||||||
|
|
||||||
// Plot the values (and optional line and confidence band if elected)
|
// Plot the values (and optional line and confidence band if elected)
|
||||||
PlotXY(
|
PlotXY(Xpoints, Ypoints, UpConf, LowConf, XMean, YMean, R, Slope, Intercept);
|
||||||
Xpoints, Ypoints, UpConf, LowConf, XMean, YMean, R, Slope, Intercept
|
|
||||||
{$IFNDEF USE_TACHART},Xmax, Xmin, Ymax, Ymin, N{$ENDIF}
|
|
||||||
);
|
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
ColNoSelected := nil;
|
ColNoSelected := nil;
|
||||||
@ -337,11 +332,15 @@ begin
|
|||||||
ComputeBtn.Constraints.MinWidth := w;
|
ComputeBtn.Constraints.MinWidth := w;
|
||||||
CloseBtn.Constraints.MinWidth := w;
|
CloseBtn.Constraints.MinWidth := w;
|
||||||
|
|
||||||
VarList.Constraints.MinHeight := GroupBox1.Top + GroupBox1.Height - VarList.Top;
|
ParamsPanel.Constraints.MinHeight := OptionsGroup.Top + OptionsGroup.Height +
|
||||||
VarList.Constraints.MinWidth := GroupBox1.Width;
|
OptionsGroup.BorderSpacing.Bottom + Bevel1.Height +
|
||||||
|
CloseBtn.Height + CloseBtn.BorderSpacing.Top;
|
||||||
|
ParamsPanel.Constraints.MinWidth := OptionsGroup.Width * 2 - XInBtn.Width div 2 - XInBtn.BorderSpacing.Left;
|
||||||
|
|
||||||
Constraints.MinWidth := GroupBox1.Width * 2 + XInBtn.Width + 4 * VarList.BorderSpacing.Left;
|
Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + ParamsPanel.BorderSpacing.Around*2;
|
||||||
Constraints.MinHeight := Height;
|
Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 200;
|
||||||
|
if Height < Constraints.MinHeight then Height := 1;
|
||||||
|
if Width < Constraints.MinWidth then Width := 1;
|
||||||
|
|
||||||
Position := poDesigned;
|
Position := poDesigned;
|
||||||
FAutoSized := True;
|
FAutoSized := True;
|
||||||
@ -351,253 +350,105 @@ end;
|
|||||||
procedure TPlotXYFrm.FormCreate(Sender: TObject);
|
procedure TPlotXYFrm.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Assert(OS3MainFrm <> nil);
|
Assert(OS3MainFrm <> nil);
|
||||||
|
|
||||||
|
FReportFrame := TReportFrame.Create(self);
|
||||||
|
FReportFrame.Parent := ReportPage;
|
||||||
|
FReportFrame.Align := alClient;
|
||||||
|
|
||||||
|
FChartFrame := TChartFrame.Create(self);
|
||||||
|
FChartFrame.Parent := ChartPage;
|
||||||
|
FChartFrame.Align := alClient;
|
||||||
|
FChartFrame.Chart.Legend.Alignment := laBottomCenter;
|
||||||
|
FChartFrame.Chart.Legend.ColumnCount := 3;
|
||||||
|
FChartFrame.Chart.Legend.TextFormat := tfHTML;
|
||||||
|
FChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80;
|
||||||
|
FChartFrame.Chart.BottomAxis.Intervals.MinLength := 30;
|
||||||
|
with FChartFrame.Chart.AxisList.Add do
|
||||||
|
begin
|
||||||
|
Alignment := calRight;
|
||||||
|
Marks.Source := TListChartSource.Create(self);
|
||||||
|
Marks.Style := smsLabel;
|
||||||
|
Grid.Visible := false;
|
||||||
|
end;
|
||||||
|
with FChartFrame.Chart.AxisList.Add do
|
||||||
|
begin
|
||||||
|
Alignment := calTop;
|
||||||
|
Marks.Source := TListChartSource.Create(self);
|
||||||
|
Marks.Style := smsLabel;
|
||||||
|
Grid.Visible := false;
|
||||||
|
end;
|
||||||
|
FChartFrame.ChartToolbar.Transparent := false;
|
||||||
|
FChartFrame.ChartToolbar.Color := clForm;
|
||||||
|
|
||||||
Reset;
|
Reset;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$IFDEF USE_TACHART}
|
|
||||||
function TPlotXYFrm.PlotXY(XPoints, YPoints, UpConf, LowConf: DblDyneVec;
|
function TPlotXYFrm.PlotXY(XPoints, YPoints, UpConf, LowConf: DblDyneVec;
|
||||||
XMean, YMean, R, Slope, Intercept: Double): boolean;
|
XMean, YMean, R, Slope, Intercept: Double): boolean;
|
||||||
var
|
var
|
||||||
tmpX, tmpY: DblDyneVec;
|
tmpX, tmpY: array[0..1] of Double;
|
||||||
ext: TDoubleRect;
|
|
||||||
xmin, xmax, ymin, ymax: Double;
|
xmin, xmax, ymin, ymax: Double;
|
||||||
|
rightLabels: TListChartSource;
|
||||||
|
topLabels: TListChartSource;
|
||||||
|
ser: TChartSeries;
|
||||||
begin
|
begin
|
||||||
if ChartForm = nil then
|
rightLabels := FChartFrame.Chart.AxisList[2].Marks.Source as TListChartSource;
|
||||||
ChartForm := TChartForm.Create(Application)
|
rightLabels.Clear;
|
||||||
else
|
topLabels := FChartFrame.Chart.AxisList[3].Marks.Source as TListChartSource;
|
||||||
ChartForm.Clear;
|
topLabels.Clear;
|
||||||
|
|
||||||
|
FChartFrame.Clear;
|
||||||
|
|
||||||
// Titles
|
// Titles
|
||||||
ChartForm.SetTitle('X vs. Y plot using file ' + OS3MainFrm.FileNameEdit.Text);
|
FChartFrame.SetTitle('X vs. Y plot using file ' + OS3MainFrm.FileNameEdit.Text);
|
||||||
ChartForm.SetFooter(Format('R(X,Y) = %.3f, Slope = %.3f, Intercept = %.3f', [
|
FChartFrame.SetFooter(Format('R(X,Y) = %.3f, Slope = %.3f, Intercept = %.3f', [
|
||||||
R, Slope, Intercept
|
R, Slope, Intercept
|
||||||
]));
|
]));
|
||||||
ChartForm.SetXTitle(XEdit.Text);
|
FChartFrame.SetXTitle(XEdit.Text);
|
||||||
ChartForm.SetYTitle(YEdit.Text);
|
FChartFrame.SetYTitle(YEdit.Text);
|
||||||
|
|
||||||
// Draw upper confidence band
|
// Draw upper confidence band
|
||||||
if ConfChk.Checked then
|
if ConfChk.Checked then
|
||||||
ChartForm.PlotXY(ptLines, XPoints, UpConf, nil, nil, 'Upper confidence band', clRed);
|
begin
|
||||||
|
ser := FChartFrame.PlotXY(ptLines, XPoints, UpConf, nil, nil, 'Upper confidence band', clRed);
|
||||||
|
rightLabels.Add(ser.yValue[ser.Count-1], ser.YValue[ser.Count-1], 'UCL');
|
||||||
|
end;
|
||||||
|
|
||||||
// Plot data points
|
// Plot data points
|
||||||
ChartForm.PlotXY(ptSymbols, XPoints, YPoints, nil, nil, 'Data values', clNavy);
|
FChartFrame.PlotXY(ptSymbols, XPoints, YPoints, nil, nil, 'Data values', clNavy);
|
||||||
|
|
||||||
// Draw lower confidence band
|
// Draw lower confidence band
|
||||||
if ConfChk.Checked then
|
if ConfChk.Checked then
|
||||||
ChartForm.PlotXY(ptLines, XPoints, LowConf, nil, nil, 'Lower confidence band', clRed);
|
begin
|
||||||
|
ser := FChartFrame.PlotXY(ptLines, XPoints, LowConf, nil, nil, 'Lower confidence band', clRed);
|
||||||
|
rightLabels.Add(ser.yValue[ser.Count-1], ser.YValue[ser.Count-1], 'LCL');
|
||||||
|
end;
|
||||||
|
|
||||||
ChartForm.Chart.Prepare;
|
FChartFrame.Chart.Prepare;
|
||||||
ChartForm.GetXRange(xmin, xmax, false);
|
FChartFrame.GetXRange(xmin, xmax, false);
|
||||||
ChartForm.GetYRange(ymin, ymax, false);
|
FChartFrame.GetYRange(ymin, ymax, false);
|
||||||
|
|
||||||
// Draw means
|
// Draw means
|
||||||
if MeansChk.Checked then
|
if MeansChk.Checked then
|
||||||
begin
|
begin
|
||||||
ChartForm.HorLine(YMean, clGreen, psDash, 'Mean ' + YEdit.Text);
|
FChartFrame.VertLine(XMean, clGreen, psDashDot, 'Mean ' + XEdit.Text);
|
||||||
ChartForm.VertLine(XMean, clGreen, psDashDot, 'Mean ' + XEdit.Text);
|
topLabels.Add(XMean, XMean, Format('Mean(%s)', [XEdit.Text]));
|
||||||
|
FChartFrame.HorLine(YMean, clGreen, psDash, 'Mean ' + YEdit.Text);
|
||||||
|
rightLabels.Add(YMean, YMean, Format('Mean(%s)', [YEdit.Text]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Draw regression line
|
// Draw regression line
|
||||||
if LineChk.Checked then
|
if LineChk.Checked then
|
||||||
begin
|
begin
|
||||||
SetLength(tmpX, 2);
|
|
||||||
SetLengtH(tmpY, 2);
|
|
||||||
tmpX[0] := xmin; tmpY[0] := tmpX[0] * slope + intercept;
|
tmpX[0] := xmin; tmpY[0] := tmpX[0] * slope + intercept;
|
||||||
tmpX[1] := xmax; tmpY[1] := tmpX[1] * slope + intercept;
|
tmpX[1] := xmax; tmpY[1] := tmpX[1] * slope + intercept;
|
||||||
ChartForm.PlotXY(ptLines, tmpX, tmpY, nil, nil, 'Predicted', clBlack);
|
ser := FChartFrame.PlotXY(ptLines, tmpX, tmpY, nil, nil, 'Predicted', clBlack);
|
||||||
|
rightLabels.Add(tmpY[1], tmpY[1], 'Predicted');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Show chart
|
FChartFrame.Chart.Legend.Visible := false;
|
||||||
Result := ChartForm.ShowModal <> mrClose;
|
|
||||||
end;
|
end;
|
||||||
{$ELSE}
|
|
||||||
function TPlotXYFrm.PlotXY(XPoints, YPoints, UpConf, LowConf: DblDyneVec;
|
|
||||||
{ConfBand, }XMean, YMean, R, Slope, Intercept, XMax, XMin, YMax, YMin: Double;
|
|
||||||
N: Integer): Boolean;
|
|
||||||
var
|
|
||||||
i, 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.Image1.Canvas.Clear;
|
|
||||||
BlankFrm.Show;
|
|
||||||
|
|
||||||
Title := 'X versus Y PLOT Using File: ' + OS3MainFrm.FileNameEdit.Text;
|
|
||||||
BlankFrm.Caption := Title;
|
|
||||||
|
|
||||||
imagewide := BlankFrm.Image1.Width;
|
|
||||||
imagehi := BlankFrm.Image1.Height;
|
|
||||||
vtop := 20;
|
|
||||||
vbottom := round(imagehi) - 80;
|
|
||||||
vhi := vbottom - vtop;
|
|
||||||
hleft := 100;
|
|
||||||
hright := imagewide - 80;
|
|
||||||
hwide := hright - hleft;
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
|
|
||||||
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
|
|
||||||
|
|
||||||
// Draw chart border
|
|
||||||
BlankFrm.Image1.Canvas.Rectangle(0,0,imagewide,imagehi);
|
|
||||||
|
|
||||||
// draw Means
|
|
||||||
if MeansChk.Checked then
|
|
||||||
begin
|
|
||||||
ypos := round(vhi * ( (Ymax - Ymean) / (Ymax - Ymin)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := hleft;
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
xpos := hright;
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clGreen;
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
Title := 'MEAN ' + YEdit.Text;
|
|
||||||
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
|
|
||||||
ypos := ypos - strhi div 2;
|
|
||||||
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
|
|
||||||
|
|
||||||
xpos := round(hwide * ( (Xmean - Xmin) / (Xmax - Xmin)));
|
|
||||||
xpos := xpos + hleft;
|
|
||||||
ypos := vtop;
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
ypos := vbottom;
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clGreen;
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
Title := 'MEAN ' + XEdit.Text;
|
|
||||||
strhi := BlankFrm.Image1.Canvas.TextWidth(Title);
|
|
||||||
xpos := xpos - strhi div 2;
|
|
||||||
ypos := vtop - BlankFrm.Image1.Canvas.TextHeight(Title);
|
|
||||||
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
|
|
||||||
end;
|
|
||||||
|
|
||||||
// draw slope line
|
|
||||||
if LineChk.Checked then
|
|
||||||
begin
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
|
|
||||||
Yvalue := (Xpoints[0] * slope) + intercept; // predicted score
|
|
||||||
ypos := round(vhi * ( (Ymax - Yvalue) / (Ymax - Ymin)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := round(hwide * ( (Xpoints[0]- Xmin) / (Xmax - Xmin)));
|
|
||||||
xpos := xpos + hleft;
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
|
|
||||||
Yvalue := (Xpoints[N-1] * slope) + intercept; // predicted score
|
|
||||||
ypos := round(vhi * ( (Ymax - Yvalue) / (Ymax - Ymin)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := round(hwide * ( (Xpoints[N-1] - Xmin) / (Xmax - Xmin)));
|
|
||||||
xpos := xpos + hleft;
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
end;
|
|
||||||
|
|
||||||
// draw horizontal axis
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(hleft,vbottom);
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(hright,vbottom);
|
|
||||||
valincr := (Xmax - Xmin) / 10.0;
|
|
||||||
for i := 1 to 11 do
|
|
||||||
begin
|
|
||||||
ypos := vbottom;
|
|
||||||
Xvalue := Xmin + valincr * (i - 1);
|
|
||||||
xpos := round(hwide * ((Xvalue - Xmin) / (Xmax - Xmin)));
|
|
||||||
xpos := xpos + hleft;
|
|
||||||
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 div 2) - (BlankFrm.Image1.Canvas.TextWidth(XEdit.Text) div 2);
|
|
||||||
ypos := vbottom + 20;
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,XEdit.Text);
|
|
||||||
Title := format('R(X,Y) = %5.3f, Slope = %6.2f, Intercept = %6.2f', [
|
|
||||||
R, Slope, Intercept
|
|
||||||
]);
|
|
||||||
xpos := hleft + (hwide div 2) - (BlankFrm.Image1.Canvas.TextWidth(Title) div 2);
|
|
||||||
ypos := ypos + 15;
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
|
|
||||||
|
|
||||||
// Draw vertical axis
|
|
||||||
Title := YEdit.Text;
|
|
||||||
xpos := hleft - BlankFrm.Image1.Canvas.TextWidth(Title) div 2;
|
|
||||||
ypos := vtop - BlankFrm.Image1.Canvas.TextHeight(Title);
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,YEdit.Text);
|
|
||||||
xpos := hleft;
|
|
||||||
ypos := vtop;
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
ypos := vbottom;
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
valincr := (Ymax - Ymin) / 10.0;
|
|
||||||
for i := 1 to 11 do
|
|
||||||
begin
|
|
||||||
Title := format('%8.2f',[Ymax - ((i-1)*valincr)]);
|
|
||||||
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
|
|
||||||
xpos := 10;
|
|
||||||
Yvalue := Ymax - (valincr * (i-1));
|
|
||||||
ypos := round(vhi * ( (Ymax - Yvalue) / (Ymax - Ymin)));
|
|
||||||
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 i := 0 to N-1 do
|
|
||||||
begin
|
|
||||||
ypos := round(vhi * ( (Ymax - Ypoints[i]) / (Ymax - Ymin)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := round(hwide * ( (Xpoints[i] - Xmin) / (Xmax - Xmin)));
|
|
||||||
xpos := xpos + hleft;
|
|
||||||
BlankFrm.Image1.Canvas.Brush.Color := clNavy;
|
|
||||||
BlankFrm.Image1.Canvas.Brush.Style := bsSolid;
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clNavy;
|
|
||||||
BlankFrm.Image1.Canvas.Ellipse(xpos,ypos,xpos+5,ypos+5);
|
|
||||||
end;
|
|
||||||
|
|
||||||
// draw confidence bands if requested
|
|
||||||
// if ConfBand <> 0.0 then
|
|
||||||
if ConfChk.Checked then
|
|
||||||
begin
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clRed;
|
|
||||||
ypos := round(vhi * ((Ymax - UpConf[0]) / (Ymax - Ymin)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := round(hwide * ( (Xpoints[0] - Xmin) / (Xmax - Xmin)));
|
|
||||||
xpos := xpos + hleft;
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
for i := 1 to N-1 do
|
|
||||||
begin
|
|
||||||
ypos := round(vhi * ((Ymax - UpConf[i]) / (Ymax - Ymin)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := round(hwide * ( (Xpoints[i] - Xmin) / (Xmax - Xmin)));
|
|
||||||
xpos := xpos + hleft;
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
end;
|
|
||||||
ypos := round(vhi * ((Ymax - lowConf[0]) / (Ymax - Ymin)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := round(hwide * ( (Xpoints[0] - Xmin) / (Xmax - Xmin)));
|
|
||||||
xpos := xpos + hleft;
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
for i := 1 to N-1 do
|
|
||||||
begin
|
|
||||||
ypos := round(vhi * ((Ymax - lowConf[i]) / (Ymax - Ymin)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := round(hwide * ( (Xpoints[i] - Xmin) / (Xmax - Xmin)));
|
|
||||||
xpos := xpos + hleft;
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
|
|
||||||
procedure TPlotXYFrm.UpdateBtnStates;
|
procedure TPlotXYFrm.UpdateBtnStates;
|
||||||
|
Reference in New Issue
Block a user