You've already forked lazarus-ccr
LazStats: Integrate report and chart into MultXvsYUnit. Some simplifications.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7703 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1425,6 +1425,7 @@
|
||||
<Filename Value="forms\misc\basicstatsformunit.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="BasicStatsForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="BasicStatsFormUnit"/>
|
||||
</Unit175>
|
||||
|
@ -1,44 +1,140 @@
|
||||
object MultXvsYFrm: TMultXvsYFrm
|
||||
Left = 814
|
||||
inherited MultXvsYFrm: TMultXvsYFrm
|
||||
Left = 431
|
||||
Height = 416
|
||||
Top = 216
|
||||
Width = 395
|
||||
Top = 221
|
||||
Width = 1065
|
||||
HelpType = htKeyword
|
||||
HelpKeyword = 'html/MultipleGroupXVersusYPlot.htm'
|
||||
Anchors = [akLeft]
|
||||
AutoSize = True
|
||||
Caption = 'Multiple X Versus Y Plot'
|
||||
ClientHeight = 416
|
||||
ClientWidth = 395
|
||||
ClientWidth = 1065
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
Position = poMainFormCenter
|
||||
LCLVersion = '2.1.0.0'
|
||||
object Bevel1: TBevel
|
||||
AnchorSideTop.Control = LabelEdit
|
||||
Left = 0
|
||||
Height = 8
|
||||
Top = 367
|
||||
Width = 395
|
||||
Align = alBottom
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
object Panel2: TPanel
|
||||
object ParamsPanel: TPanel[0]
|
||||
Left = 8
|
||||
Height = 328
|
||||
Height = 400
|
||||
Top = 8
|
||||
Width = 379
|
||||
Align = alClient
|
||||
Width = 344
|
||||
Align = alLeft
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 8
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 400
|
||||
ClientWidth = 344
|
||||
TabOrder = 0
|
||||
object ResetBtn: TButton
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
AnchorSideBottom.Control = ParamsPanel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 143
|
||||
Height = 25
|
||||
Top = 375
|
||||
Width = 54
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 328
|
||||
ClientWidth = 379
|
||||
Caption = 'Reset'
|
||||
OnClick = ResetBtnClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object ComputeBtn: TButton
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
AnchorSideBottom.Control = ParamsPanel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 205
|
||||
Height = 25
|
||||
Top = 375
|
||||
Width = 76
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Compute'
|
||||
OnClick = ComputeBtnClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object CloseBtn: TButton
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ParamsPanel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 289
|
||||
Height = 25
|
||||
Top = 375
|
||||
Width = 55
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'Close'
|
||||
ModalResult = 11
|
||||
OnClick = CloseBtnClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object HelpBtn: TButton
|
||||
Tag = 134
|
||||
AnchorSideRight.Control = ResetBtn
|
||||
AnchorSideBottom.Control = ParamsPanel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 84
|
||||
Height = 25
|
||||
Top = 375
|
||||
Width = 51
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Help'
|
||||
OnClick = HelpBtnClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object ButtonBevel: TBevel
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = CloseBtn
|
||||
Left = 0
|
||||
Height = 10
|
||||
Top = 357
|
||||
Width = 344
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
object Label5: TLabel
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideTop.Control = LabelEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 338
|
||||
Width = 46
|
||||
Caption = 'Plot Title'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelEdit: TEdit
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ButtonBevel
|
||||
Left = 54
|
||||
Height = 23
|
||||
Top = 334
|
||||
Width = 290
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
TabOrder = 4
|
||||
TextHint = 'Text above the plot'
|
||||
end
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = Panel2
|
||||
AnchorSideTop.Control = Panel2
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideTop.Control = ParamsPanel
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 0
|
||||
@ -47,377 +143,264 @@ object MultXvsYFrm: TMultXvsYFrm
|
||||
ParentColor = False
|
||||
end
|
||||
object VarList: TListBox
|
||||
AnchorSideLeft.Control = Panel2
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideBottom.Control = Panel2
|
||||
AnchorSideRight.Control = XInBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 311
|
||||
Height = 309
|
||||
Top = 17
|
||||
Width = 190
|
||||
Width = 153
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Right = 6
|
||||
ItemHeight = 0
|
||||
OnDblClick = VarListDblClick
|
||||
OnSelectionChange = VarListSelectionChange
|
||||
TabOrder = 0
|
||||
end
|
||||
object Panel1: TPanel
|
||||
AnchorSideTop.Control = VarList
|
||||
AnchorSideRight.Control = Panel2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 198
|
||||
Height = 310
|
||||
Top = 17
|
||||
Width = 181
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 310
|
||||
ClientWidth = 181
|
||||
TabOrder = 1
|
||||
object Label2: TLabel
|
||||
AnchorSideLeft.Control = XEdit
|
||||
AnchorSideBottom.Control = XEdit
|
||||
Left = 36
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 51
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 2
|
||||
Caption = 'X Variable'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label3: TLabel
|
||||
AnchorSideLeft.Control = YEdit
|
||||
AnchorSideBottom.Control = YEdit
|
||||
Left = 36
|
||||
Height = 15
|
||||
Top = 92
|
||||
Width = 51
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 2
|
||||
Caption = 'Y Variable'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label4: TLabel
|
||||
AnchorSideLeft.Control = GroupEdit
|
||||
AnchorSideBottom.Control = GroupEdit
|
||||
Left = 36
|
||||
Height = 15
|
||||
Top = 176
|
||||
Width = 77
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 2
|
||||
Caption = 'Group Variable'
|
||||
ParentColor = False
|
||||
TabOrder = 5
|
||||
end
|
||||
object XInBtn: TBitBtn
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = Panel1
|
||||
Left = 0
|
||||
Height = 28
|
||||
Top = 0
|
||||
Width = 28
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = VarList
|
||||
Left = 159
|
||||
Height = 26
|
||||
Top = 17
|
||||
Width = 26
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 1
|
||||
OnClick = XInBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 0
|
||||
TabOrder = 6
|
||||
end
|
||||
object XOutBtn: TBitBtn
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = XInBtn
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 28
|
||||
Top = 32
|
||||
Width = 28
|
||||
Left = 159
|
||||
Height = 26
|
||||
Top = 47
|
||||
Width = 26
|
||||
BorderSpacing.Top = 4
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 0
|
||||
OnClick = XOutBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 1
|
||||
TabOrder = 7
|
||||
end
|
||||
object YInBtn: TBitBtn
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = XOutBtn
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 28
|
||||
Top = 84
|
||||
Width = 28
|
||||
Left = 159
|
||||
Height = 26
|
||||
Top = 97
|
||||
Width = 26
|
||||
BorderSpacing.Top = 24
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 1
|
||||
OnClick = YInBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 3
|
||||
TabOrder = 8
|
||||
end
|
||||
object YOutBtn: TBitBtn
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = YInBtn
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 28
|
||||
Top = 116
|
||||
Width = 28
|
||||
Left = 159
|
||||
Height = 26
|
||||
Top = 127
|
||||
Width = 26
|
||||
BorderSpacing.Top = 4
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 0
|
||||
OnClick = YOutBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 4
|
||||
TabOrder = 9
|
||||
end
|
||||
object GroupInBtn: TBitBtn
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = YOutBtn
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 28
|
||||
Top = 168
|
||||
Width = 28
|
||||
Left = 159
|
||||
Height = 26
|
||||
Top = 177
|
||||
Width = 26
|
||||
BorderSpacing.Top = 24
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 1
|
||||
OnClick = GroupInBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 6
|
||||
TabOrder = 10
|
||||
end
|
||||
object GroupOutBtn: TBitBtn
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideLeft.Control = ParamsPanel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = GroupInBtn
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 28
|
||||
Top = 200
|
||||
Width = 28
|
||||
Left = 159
|
||||
Height = 26
|
||||
Top = 207
|
||||
Width = 26
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Bottom = 8
|
||||
Images = MainDataModule.ImageList
|
||||
ImageIndex = 0
|
||||
OnClick = GroupOutBtnClick
|
||||
Spacing = 0
|
||||
TabOrder = 7
|
||||
TabOrder = 11
|
||||
end
|
||||
object XEdit: TEdit
|
||||
AnchorSideLeft.Control = XInBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = XOutBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 36
|
||||
Height = 23
|
||||
Top = 25
|
||||
Width = 145
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Bottom = 12
|
||||
ReadOnly = True
|
||||
TabOrder = 2
|
||||
Text = 'XEdit'
|
||||
end
|
||||
object YEdit: TEdit
|
||||
AnchorSideLeft.Control = XInBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = YOutBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 36
|
||||
Height = 23
|
||||
Top = 109
|
||||
Width = 145
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Bottom = 12
|
||||
ReadOnly = True
|
||||
TabOrder = 5
|
||||
Text = 'YEdit'
|
||||
end
|
||||
object GroupEdit: TEdit
|
||||
AnchorSideLeft.Control = XInBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = GroupOutBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 36
|
||||
Height = 23
|
||||
Top = 193
|
||||
Width = 145
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Bottom = 12
|
||||
ReadOnly = True
|
||||
TabOrder = 8
|
||||
Text = 'GroupEdit'
|
||||
end
|
||||
object GroupBox1: TGroupBox
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = GroupOutBtn
|
||||
object OptionsGroup: TGroupBox
|
||||
AnchorSideLeft.Control = GroupOutBtn
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 70
|
||||
Top = 240
|
||||
Width = 181
|
||||
AnchorSideBottom.Control = LabelEdit
|
||||
Left = 159
|
||||
Height = 49
|
||||
Top = 277
|
||||
Width = 182
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 12
|
||||
Caption = 'Options:'
|
||||
ClientHeight = 50
|
||||
ClientWidth = 177
|
||||
TabOrder = 9
|
||||
object DescChk: TCheckBox
|
||||
AnchorSideLeft.Control = GroupBox1
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Options'
|
||||
ChildSizing.LeftRightSpacing = 12
|
||||
ChildSizing.TopBottomSpacing = 2
|
||||
ClientHeight = 29
|
||||
ClientWidth = 178
|
||||
TabOrder = 12
|
||||
object LinesChk: TCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 2
|
||||
Width = 159
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Bottom = 2
|
||||
Caption = 'Show Descriptive Statistics'
|
||||
TabOrder = 0
|
||||
end
|
||||
object LinesChk: TCheckBox
|
||||
AnchorSideLeft.Control = DescChk
|
||||
AnchorSideTop.Control = DescChk
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 23
|
||||
Width = 157
|
||||
Width = 154
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Connect Points with Lines'
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
object Panel3: TPanel
|
||||
Left = 0
|
||||
Height = 41
|
||||
Top = 375
|
||||
Width = 395
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 41
|
||||
ClientWidth = 395
|
||||
TabOrder = 2
|
||||
object ResetBtn: TButton
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 178
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 54
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Reset'
|
||||
OnClick = ResetBtnClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object ComputeBtn: TButton
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 244
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 76
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Compute'
|
||||
OnClick = ComputeBtnClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object CloseBtn: TButton
|
||||
AnchorSideRight.Control = Panel3
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 332
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 55
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Close'
|
||||
ModalResult = 11
|
||||
OnClick = CloseBtnClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object HelpBtn: TButton
|
||||
Tag = 134
|
||||
AnchorSideRight.Control = ResetBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 115
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 51
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Help'
|
||||
OnClick = HelpBtnClick
|
||||
Caption = 'Connect points with lines'
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object Panel4: TPanel
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 344
|
||||
Width = 379
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 23
|
||||
ClientWidth = 379
|
||||
TabOrder = 1
|
||||
object Label5: TLabel
|
||||
AnchorSideLeft.Control = Panel4
|
||||
AnchorSideTop.Control = LabelEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 0
|
||||
object Label2: TLabel
|
||||
AnchorSideLeft.Control = XEdit
|
||||
AnchorSideBottom.Control = XEdit
|
||||
Left = 193
|
||||
Height = 15
|
||||
Top = 4
|
||||
Width = 46
|
||||
Caption = 'Plot Title'
|
||||
Top = 21
|
||||
Width = 51
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 2
|
||||
Caption = 'X Variable'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelEdit: TEdit
|
||||
AnchorSideLeft.Control = Label5
|
||||
object XEdit: TEdit
|
||||
AnchorSideLeft.Control = XOutBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel4
|
||||
AnchorSideRight.Control = Panel4
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 54
|
||||
AnchorSideBottom.Control = XOutBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 193
|
||||
Height = 23
|
||||
Top = 0
|
||||
Width = 325
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Top = 38
|
||||
Width = 151
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
TabOrder = 0
|
||||
TextHint = 'Text above the plot'
|
||||
BorderSpacing.Bottom = 12
|
||||
ReadOnly = True
|
||||
TabOrder = 13
|
||||
Text = 'XEdit'
|
||||
end
|
||||
object Label3: TLabel
|
||||
AnchorSideLeft.Control = YEdit
|
||||
AnchorSideBottom.Control = YEdit
|
||||
Left = 193
|
||||
Height = 15
|
||||
Top = 101
|
||||
Width = 51
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 2
|
||||
Caption = 'Y Variable'
|
||||
ParentColor = False
|
||||
end
|
||||
object YEdit: TEdit
|
||||
AnchorSideLeft.Control = YOutBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = YOutBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 193
|
||||
Height = 23
|
||||
Top = 118
|
||||
Width = 151
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Bottom = 12
|
||||
ReadOnly = True
|
||||
TabOrder = 14
|
||||
Text = 'YEdit'
|
||||
end
|
||||
object Label4: TLabel
|
||||
AnchorSideLeft.Control = GroupEdit
|
||||
AnchorSideBottom.Control = GroupEdit
|
||||
Left = 193
|
||||
Height = 15
|
||||
Top = 181
|
||||
Width = 77
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 2
|
||||
Caption = 'Group Variable'
|
||||
ParentColor = False
|
||||
end
|
||||
object GroupEdit: TEdit
|
||||
AnchorSideLeft.Control = GroupOutBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = GroupOutBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 193
|
||||
Height = 23
|
||||
Top = 198
|
||||
Width = 151
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Bottom = 12
|
||||
ReadOnly = True
|
||||
TabOrder = 15
|
||||
Text = 'GroupEdit'
|
||||
end
|
||||
end
|
||||
object PageControl: TPageControl[1]
|
||||
Left = 365
|
||||
Height = 400
|
||||
Top = 8
|
||||
Width = 692
|
||||
ActivePage = ReportPage
|
||||
Align = alClient
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
TabIndex = 0
|
||||
TabOrder = 1
|
||||
object ReportPage: TTabSheet
|
||||
Caption = 'Report'
|
||||
end
|
||||
object ChartPage: TTabSheet
|
||||
Caption = 'Chart'
|
||||
end
|
||||
end
|
||||
object ParamsSplitter: TSplitter[2]
|
||||
Left = 356
|
||||
Height = 416
|
||||
Top = 0
|
||||
Width = 5
|
||||
ResizeStyle = rsPattern
|
||||
end
|
||||
end
|
||||
|
@ -3,27 +3,27 @@
|
||||
unit MultXvsYUnit;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$i ../../../LazStats.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, ExtCtrls, Buttons, Clipbrd,
|
||||
MainUnit, Globals, OutputUnit, DataProcs, DictionaryUnit, ContextHelpUnit,
|
||||
BasicStatsFormUnit;
|
||||
StdCtrls, ExtCtrls, Buttons, Clipbrd, ComCtrls,
|
||||
MainUnit, Globals, DataProcs, DictionaryUnit, ContextHelpUnit,
|
||||
BasicStatsFormUnit, ReportFrameUnit, ChartFrameUnit;
|
||||
|
||||
type
|
||||
|
||||
{ TMultXvsYFrm }
|
||||
|
||||
TMultXvsYFrm = class(TBasicStatsForm)
|
||||
Bevel1: TBevel;
|
||||
ButtonBevel: TBevel;
|
||||
HelpBtn: TButton;
|
||||
Panel1: TPanel;
|
||||
Panel2: TPanel;
|
||||
Panel3: TPanel;
|
||||
Panel4: TPanel;
|
||||
PageControl: TPageControl;
|
||||
ParamsPanel: TPanel;
|
||||
ParamsSplitter: TSplitter;
|
||||
ReportPage: TTabSheet;
|
||||
ChartPage: TTabSheet;
|
||||
XInBtn: TBitBtn;
|
||||
XOutBtn: TBitBtn;
|
||||
YInBtn: TBitBtn;
|
||||
@ -33,12 +33,11 @@ type
|
||||
ResetBtn: TButton;
|
||||
ComputeBtn: TButton;
|
||||
CloseBtn: TButton;
|
||||
DescChk: TCheckBox;
|
||||
LinesChk: TCheckBox;
|
||||
XEdit: TEdit;
|
||||
YEdit: TEdit;
|
||||
GroupEdit: TEdit;
|
||||
GroupBox1: TGroupBox;
|
||||
OptionsGroup: TGroupBox;
|
||||
LabelEdit: TEdit;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
@ -54,6 +53,7 @@ type
|
||||
procedure GroupOutBtnClick(Sender: TObject);
|
||||
procedure HelpBtnClick(Sender: TObject);
|
||||
procedure ResetBtnClick(Sender: TObject);
|
||||
procedure VarListDblClick(Sender: TObject);
|
||||
procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean);
|
||||
procedure XInBtnClick(Sender: TObject);
|
||||
procedure XOutBtnClick(Sender: TObject);
|
||||
@ -62,12 +62,9 @@ type
|
||||
private
|
||||
{ private declarations }
|
||||
FAutoSized: Boolean;
|
||||
{$IFDEF USE_TACHART}
|
||||
procedure PlotXY(const XValues, YValues: DblDyneMat; MinGrp: Integer);
|
||||
{$ELSE}
|
||||
procedure PlotXY(const XValues, YValues: DblDyneMat;
|
||||
MaxX, MinX, MaxY, MinY: double; N, NoY, MinGrp: integer);
|
||||
{$ENDIF}
|
||||
FReportFrame: TReportFrame;
|
||||
FChartFrame: TChartFrame;
|
||||
procedure PlotXY(const XValues, YValues: DblDyneMat; const Groups: StrDyneVec);
|
||||
procedure UpdateBtnStates;
|
||||
|
||||
public
|
||||
@ -83,197 +80,134 @@ implementation
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
{$IFDEF USE_TACHART}
|
||||
TATypes,
|
||||
ChartFrameUnit, ChartUnit,
|
||||
{$ELSE}
|
||||
BlankFrmUnit,
|
||||
{$ENDIF}
|
||||
Math, Utils;
|
||||
|
||||
|
||||
{ TMultXvsYFrm }
|
||||
|
||||
procedure TMultXvsYFrm.Reset;
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
VarList.Clear;
|
||||
for i := 1 to NoVariables do
|
||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||
XEdit.Text := '';
|
||||
YEdit.Text := '';
|
||||
GroupEdit.Text := '';
|
||||
DescChk.Checked := false;
|
||||
LinesChk.Checked := false;
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.ResetBtnClick(Sender: TObject);
|
||||
begin
|
||||
Reset;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.VarListSelectionChange(Sender: TObject; User: boolean);
|
||||
begin
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.GroupInBtnClick(Sender: TObject);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
i := VarList.ItemIndex;
|
||||
if (i > -1) and (GroupEdit.Text = '') then
|
||||
begin
|
||||
GroupEdit.Text := VarList.Items[i];
|
||||
VarList.Items.Delete(i);
|
||||
end;
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.ComputeBtnClick(Sender: TObject);
|
||||
var
|
||||
lReport: TStrings;
|
||||
i, N, NoGrps, XCol, YCol, GrpCol, Grp, MinGrp, MaxGrp: integer;
|
||||
MinX, MaxX, MinY, MaxY, X, Y: double;
|
||||
i, N, xCol, yCol, grpCol, grp, numGrps: integer;
|
||||
grpName: String;
|
||||
//minX, maxX, minY, maxY,
|
||||
X, Y: double;
|
||||
cellstring: string;
|
||||
MaxGrpSize: integer;
|
||||
NoInGrp: IntDyneVec = nil;
|
||||
XValues: DblDyneMat = nil;
|
||||
YValues: DblDyneMat = nil;
|
||||
Means: array[0..1] of Double = (0.0, 0.0);
|
||||
StdDevs: array[0..1] of Double = (0.0, 0.0);
|
||||
maxGrpSize: integer = 0;
|
||||
numInGrp: IntDyneVec = nil;
|
||||
xValues: DblDyneMat = nil;
|
||||
yValues: DblDyneMat = nil;
|
||||
grps: StrDyneVec = nil;
|
||||
means: array[0..1] of Double = (0.0, 0.0);
|
||||
stdDevs: array[0..1] of Double = (0.0, 0.0);
|
||||
selected: array[0..2] of Integer = (0, 0, 0);
|
||||
NoSelected: Integer = 3;
|
||||
begin
|
||||
MaxGrpSize := 0;
|
||||
MaxX := -Infinity;
|
||||
MinX := Infinity;
|
||||
MaxY := -Infinity;
|
||||
MinY := Infinity;
|
||||
|
||||
// Get selected variables
|
||||
XCol := 0;
|
||||
YCol := 0;
|
||||
GrpCol := 0;
|
||||
xCol := 0;
|
||||
yCol := 0;
|
||||
grpCol := 0;
|
||||
for i := 1 to NoVariables do
|
||||
begin
|
||||
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
|
||||
if (cellstring = XEdit.Text) then selected[0] := i;
|
||||
if (cellstring = YEdit.Text) then selected[1] := i;
|
||||
if (cellstring = GroupEdit.Text) then selected[2] := i;
|
||||
cellstring := OS3MainFrm.DataGrid.Cells[i, 0];
|
||||
if (cellstring = XEdit.Text) then xCol := i;
|
||||
if (cellstring = YEdit.Text) then yCol := i;
|
||||
if (cellstring = GroupEdit.Text) then grpCol := i;
|
||||
end;
|
||||
XCol := selected[0];
|
||||
YCol := selected[1];
|
||||
GrpCol := selected[2];
|
||||
|
||||
if (XCol = 0) or (YCol = 0) or (GrpCol = 0) then
|
||||
if (xCol = 0) or (yCol = 0) or (grpCol = 0) then
|
||||
begin
|
||||
ErrorMsg('No variable selected.');
|
||||
exit;
|
||||
end;
|
||||
|
||||
// Get number of groups
|
||||
MinGrp := MaxInt;
|
||||
MaxGrp := -MaxInt;
|
||||
selected[0] := xCol;
|
||||
selected[1] := yCol;
|
||||
selected[2] := grpCol;
|
||||
|
||||
// Get groups
|
||||
// minGrp := MaxInt;
|
||||
// maxGrp := -MaxInt;
|
||||
SetLength(grps, NoCases);
|
||||
numGrps := 0;
|
||||
for i := 1 to NoCases do
|
||||
begin
|
||||
Grp := StrToInt(OS3MainFrm.DataGrid.Cells[GrpCol, i]);
|
||||
MaxGrp := Max(MaxGrp, Grp);
|
||||
MinGrp := Min(MinGrp, Grp);
|
||||
grpName := Trim(OS3MainFrm.DataGrid.Cells[grpCol, i]);
|
||||
if IndexOfString(grps, grpName) = -1 then
|
||||
begin
|
||||
grps[numGrps] := grpName;
|
||||
inc(numGrps);
|
||||
end;
|
||||
end;
|
||||
NoGrps := (MaxGrp - MinGrp) + 1;
|
||||
|
||||
SetLength(XValues, NoGrps, NoCases); // NoCases is over-dimensioned and will be trimmed later.
|
||||
SetLength(YValues, NoGrps, NoCases); // dto.
|
||||
SetLength(NoInGrp, NoGrps);
|
||||
for i := 0 to NoGrps - 1 do NoInGrp[i] := 0;
|
||||
SetLength(XValues, numGrps, NoCases); // NoCases is over-dimensioned and will be trimmed later.
|
||||
SetLength(YValues, numGrps, NoCases); // dto.
|
||||
SetLength(numInGrp, numGrps);
|
||||
|
||||
N := 0;
|
||||
for i := 1 to NoCases do
|
||||
begin
|
||||
if (not GoodRecord(i, NoSelected, selected))then continue;
|
||||
if not GoodRecord(i, Length(selected), selected) then continue;
|
||||
inc(N);
|
||||
|
||||
X := StrToFloat(OS3MainFrm.DataGrid.Cells[XCol, i]);
|
||||
MaxX := Max(MaxX, X);
|
||||
MinX := Min(MinX, X);
|
||||
|
||||
Y := StrToFloat(OS3MainFrm.DataGrid.Cells[YCol, i]);
|
||||
MaxY := Max(MaxY, Y);
|
||||
MinY := Min(MinY, Y);
|
||||
grpName := Trim(OS3MainFrm.DataGrid.Cells[grpCol, i]);
|
||||
grp := IndexOfString(grps, grpName);
|
||||
|
||||
Grp := StrToInt(OS3MainFrm.DataGrid.Cells[GrpCol, i]) - MinGrp;
|
||||
XValues[Grp, NoInGrp[Grp]] := StrToFloat(OS3MainFrm.DataGrid.Cells[XCol, i]);
|
||||
YValues[Grp, NoInGrp[Grp]] := Y;
|
||||
inc(NoInGrp[Grp]);
|
||||
MaxGrpSize := Max(MaxGrpsize, NoInGrp[Grp]);
|
||||
end;
|
||||
xValues[grp, numInGrp[grp]] := X;
|
||||
yValues[grp, numInGrp[grp]] := Y;
|
||||
inc(numInGrp[grp]);
|
||||
|
||||
// Trim XValues and YValues to correct dimension.
|
||||
SetLength(XValues, NoGrps);
|
||||
SetLength(YValues, NoGrps);
|
||||
for grp := 0 to NoGrps-1 do
|
||||
begin
|
||||
SetLength(XValues[grp], NoInGrp[grp]);
|
||||
SetLength(YValues[grp], NoInGrp[grp]);
|
||||
end;
|
||||
|
||||
// get descriptive data
|
||||
if DescChk.Checked then
|
||||
begin
|
||||
for i := 1 to NoCases do
|
||||
begin
|
||||
if (not GoodRecord(i,NoSelected,selected)) then continue;
|
||||
Y := StrToFloat(OS3MainFrm.DataGrid.Cells[YCol,i]);
|
||||
X := StrToFloat(OS3MainFrm.DataGrid.Cells[XCol,i]);
|
||||
Means[0] := Means[0] + X;
|
||||
StdDevs[0] := StdDevs[0] + sqr(X);
|
||||
Means[1] := Means[1] + Y;
|
||||
StdDevs[1] := StdDevs[1] + sqr(Y);
|
||||
end;
|
||||
|
||||
for i := 0 to 1 do
|
||||
// Trim XValues and YValues to correct dimension.
|
||||
SetLength(xValues, numGrps);
|
||||
SetLength(yValues, numGrps);
|
||||
for grp := 0 to numGrps-1 do
|
||||
begin
|
||||
StdDevs[i] := StdDevs[i] - sqr(Means[i]) / N;
|
||||
StdDevs[i] := sqrt(StdDevs[i] / (N - 1));
|
||||
Means[i] := Means[i] / N;
|
||||
SetLength(xValues[grp], numInGrp[grp]);
|
||||
SetLength(yValues[grp], numInGrp[grp]);
|
||||
end;
|
||||
|
||||
// Get descriptive data
|
||||
for i := 0 to 1 do
|
||||
begin
|
||||
stdDevs[i] := stdDevs[i] - sqr(means[i]) / N;
|
||||
stdDevs[i] := sqrt(StdDevs[i] / (N - 1));
|
||||
means[i] := means[i] / N;
|
||||
end;
|
||||
|
||||
// Print out descriptive data to report frame
|
||||
lReport := TStringList.Create;
|
||||
try
|
||||
lReport.Add('X VERSUS Y FOR GROUPS PLOT');
|
||||
lReport.Add('');
|
||||
lReport.Add('X variable: ' + XEdit.Text);
|
||||
lReport.Add('Y variable: ' + YEdit.Text);
|
||||
lReport.Add('Group variable: ' + GroupEdit.Text);
|
||||
lReport.Add('');
|
||||
|
||||
lReport.Add('VARIABLE MEAN STANDARD DEVIATION');
|
||||
lReport.Add(' X %9.3f %14.3f', [Means[0], StdDevs[0]]);
|
||||
lReport.Add(' Y %9.3f %14.3f', [Means[1], StdDevs[1]]);
|
||||
lReport.Add('-------- -------- ------------------');
|
||||
lReport.Add(' X %8.3f %14.3f', [Means[0], StdDevs[0]]);
|
||||
lReport.Add(' Y %8.3f %14.3f', [Means[1], StdDevs[1]]);
|
||||
lReport.Add('');
|
||||
|
||||
DisplayReport(lReport);
|
||||
FReportFrame.DisplayReport(lReport);
|
||||
finally
|
||||
lReport.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
// sort on X
|
||||
for i := 0 to NoGrps - 1 do
|
||||
for i := 0 to numGrps - 1 do
|
||||
SortOnX(XValues[i], YValues[i]);
|
||||
|
||||
// Plot data
|
||||
PlotXY(XValues, YValues{$IFNDEF USE_TACHART}, MaxX, MinX, MaxY, MinY, MaxGrpSize, NoGrps{$ENDIF}, MinGrp);
|
||||
|
||||
NoInGrp := nil;
|
||||
XValues := nil;
|
||||
YValues := nil;
|
||||
PlotXY(XValues, YValues, grps);
|
||||
end;
|
||||
|
||||
|
||||
@ -296,8 +230,17 @@ begin
|
||||
ComputeBtn.Constraints.MinWidth := w;
|
||||
CloseBtn.Constraints.MinWidth := w;
|
||||
|
||||
Constraints.MinWidth := Width;
|
||||
Constraints.MinHeight := Height;
|
||||
ParamsPanel.Constraints.MinWidth := Max(
|
||||
4*w + 3*CloseBtn.BorderSpacing.Left,
|
||||
OptionsGroup.Width - XInBtn.Width div 2);
|
||||
ParamsPanel.Constraints.MinHeight := GroupOutBtn.Top + GroupOutBtn.Height +
|
||||
OptionsGroup.BorderSpacing.Top + OptionsGroup.Height + OptionsGroup.BorderSpacing.Bottom +
|
||||
LabelEdit.Height + ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
|
||||
|
||||
Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 300;
|
||||
Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + ParamsPanel.BorderSpacing.Top*2;
|
||||
if Width < Constraints.MinWidth then Width := 1; // enforce contraints
|
||||
if Height < Constraints.MinHeight then Height := 1;
|
||||
|
||||
Position := poDesigned;
|
||||
FAutoSized := true;
|
||||
@ -308,10 +251,37 @@ procedure TMultXvsYFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Assert(OS3MainFrm <> nil);
|
||||
if DictionaryFrm = nil then Application.CreateForm(TDictionaryFrm, DictionaryFrm);
|
||||
|
||||
InitForm(self);
|
||||
|
||||
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;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.GroupInBtnClick(Sender: TObject);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
i := VarList.ItemIndex;
|
||||
if (i > -1) and (GroupEdit.Text = '') then
|
||||
begin
|
||||
GroupEdit.Text := VarList.Items[i];
|
||||
VarList.Items.Delete(i);
|
||||
end;
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.GroupOutBtnClick(Sender: TObject);
|
||||
begin
|
||||
if GroupEdit.Text <> '' then
|
||||
@ -331,6 +301,110 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
// Routine to plot X versus multiple Y values for several groups
|
||||
// Layout of X and Y matrices:
|
||||
// 1st index: group index, 2nd index: point index within group
|
||||
procedure TMultXvsYFrm.PlotXY(const XValues, YValues: DblDyneMat;
|
||||
const Groups: StrDyneVec);
|
||||
var
|
||||
pt: TPlotType;
|
||||
grp: Integer;
|
||||
clr: TColor;
|
||||
grpName: String;
|
||||
sym: TSeriesPointerStyle;
|
||||
begin
|
||||
FChartFrame.Clear;
|
||||
|
||||
// Titles
|
||||
FChartFrame.SetTitle(LabelEdit.Text);
|
||||
FChartFrame.SetXTitle(XEdit.Text);
|
||||
FChartFrame.SetYTitle(YEdit.Text);
|
||||
|
||||
if LinesChk.Checked then pt := ptLinesAndSymbols else pt := ptSymbols;
|
||||
|
||||
for grp := 0 to Length(XValues)-1 do
|
||||
begin
|
||||
clr := DATA_COLORS[grp mod Length(DATA_COLORS)];
|
||||
sym := DATA_SYMBOLS[grp mod Length(DATA_SYMBOLS)];
|
||||
grpName := Format('%s %s', [GroupEdit.Text, Groups[grp]]);
|
||||
FChartFrame.PlotXY(pt, XValues[grp], YValues[grp], nil, nil, grpName, clr, sym);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.Reset;
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
VarList.Clear;
|
||||
for i := 1 to NoVariables do
|
||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||
XEdit.Text := '';
|
||||
YEdit.Text := '';
|
||||
GroupEdit.Text := '';
|
||||
LinesChk.Checked := false;
|
||||
FReportFrame.Clear;
|
||||
FChartFrame.Clear;
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.ResetBtnClick(Sender: TObject);
|
||||
begin
|
||||
Reset;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.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 if YEdit.Text = '' then
|
||||
YEdit.Text := VarList.Items[index]
|
||||
else if GroupEdit.Text = '' then
|
||||
GroupEdit.Text := VarList.Items[index];
|
||||
VarList.Items.Delete(index);
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.UpdateBtnStates;
|
||||
var
|
||||
lSelected: Boolean;
|
||||
i: Integer;
|
||||
begin
|
||||
lSelected := false;
|
||||
for i:=0 to VarList.Items.Count-1 do
|
||||
if VarList.Selected[i] then
|
||||
begin
|
||||
lSelected := true;
|
||||
break;
|
||||
end;
|
||||
|
||||
XInBtn.Enabled := lSelected and (XEdit.Text = '');
|
||||
YInBtn.Enabled := lSelected and (YEdit.Text = '');
|
||||
GroupInBtn.Enabled := lSelected and (GroupEdit.Text = '');
|
||||
XOutBtn.Enabled := (XEdit.Text <> '');
|
||||
YOutBtn.Enabled := (YEdit.Text <> '');
|
||||
GroupOutBtn.Enabled := (GroupEdit.Text <> '');
|
||||
|
||||
FReportFrame.UpdateBtnStates;
|
||||
FChartFrame.UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.VarListSelectionChange(Sender: TObject; User: boolean);
|
||||
begin
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMultXvsYFrm.XInBtnClick(Sender: TObject);
|
||||
var
|
||||
i: integer;
|
||||
@ -381,202 +455,5 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
// Routine to plot X versus multiple Y values for several groups
|
||||
// 1st index: group index, 2nd index: point index within group
|
||||
{$IFDEF USE_TACHART}
|
||||
procedure TMultXvsYFrm.PlotXY(const XValues, YValues: DblDyneMat; MinGrp: Integer);
|
||||
var
|
||||
pt: TPlotType;
|
||||
grp: Integer;
|
||||
clr: TColor;
|
||||
grpName: String;
|
||||
sym: TSeriesPointerStyle;
|
||||
begin
|
||||
if Length(XValues) <> Length(YValues) then
|
||||
begin
|
||||
ErrorMsg('Incorrect dimension of XValues and YValues');
|
||||
exit;
|
||||
end;
|
||||
|
||||
if ChartForm = nil then
|
||||
ChartForm := TChartForm.Create(Application)
|
||||
else
|
||||
ChartForm.Clear;
|
||||
|
||||
// Titles
|
||||
ChartForm.SetTitle(LabelEdit.Text);
|
||||
ChartForm.SetXTitle(XEdit.Text);
|
||||
chartForm.SetYTitle(YEdit.Text);
|
||||
|
||||
if LinesChk.Checked then pt := ptLinesAndSymbols else pt := ptSymbols;
|
||||
|
||||
for grp := 0 to Length(XValues)-1 do
|
||||
begin
|
||||
clr := DATA_COLORS[grp mod Length(DATA_COLORS)];
|
||||
sym := DATA_SYMBOLS[grp mod Length(DATA_SYMBOLS)];
|
||||
grpName := Format('%s = %d', [GroupEdit.Text, grp + MinGrp]);
|
||||
ChartForm.PlotXY(pt, XValues[grp], YValues[grp], nil, nil, grpName, clr, sym);
|
||||
end;
|
||||
|
||||
ChartForm.Show;
|
||||
end;
|
||||
{$ELSE}
|
||||
procedure TMultXvsYFrm.PlotXY(const XValues, YValues: DblDyneMat;
|
||||
MaxX, MinX, MaxY, MinY: double; N, NoY, MinGrp: integer);
|
||||
var
|
||||
xpos, ypos, hleft, hright, vtop, vbottom, imagewide : integer;
|
||||
vhi, hwide, offset, strhi, imagehi, i, j, Grp : integer;
|
||||
valincr, Yvalue, Xvalue, value : double;
|
||||
Title: string;
|
||||
begin
|
||||
if BlankFrm = nil then
|
||||
Application.CreateForm(TBlankFrm, BlankFrm)
|
||||
else
|
||||
BlankFrm.Image1.Canvas.Clear;
|
||||
BlankFrm.Show;
|
||||
|
||||
Title := LabelEdit.Text;
|
||||
BlankFrm.Caption := Title;
|
||||
BlankFrm.Show;
|
||||
|
||||
imagewide := BlankFrm.Image1.Width;
|
||||
imagehi := BlankFrm.Image1.Height;
|
||||
vtop := 40;
|
||||
vbottom := ceil(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
|
||||
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 + ceil(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
|
||||
value := MaxY - ((i-1) * valincr);
|
||||
Title := Format('%.2f',[value]);
|
||||
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
|
||||
xpos := hleft - 20 - BlankFrm.Image1.Canvas.TextWidth(Title);
|
||||
Yvalue := MaxY - (valincr * (i-1));
|
||||
ypos := ceil(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)];
|
||||
Grp := MinGrp + j;
|
||||
Title := 'GROUP ' + IntToStr(Grp);
|
||||
for i := 0 to N - 1 do
|
||||
begin
|
||||
xpos := hleft + ceil(hwide * ( (XValues[j, i] - MinX) / (MaxX - MinX)));
|
||||
ypos := vtop + ceil(vhi * ( (MaxY - YValues[j, i]) / (MaxY - MinY)));
|
||||
if (i = 0) then
|
||||
BlankFrm.Image1.Canvas.MoveTo(xpos, ypos);
|
||||
if LinesChk.Checked then
|
||||
BlankFrm.Image1.Canvas.LineTo(xpos, ypos);
|
||||
BlankFrm.Image1.Canvas.Ellipse(xpos, ypos, xpos+5, ypos+5);
|
||||
end;
|
||||
(*
|
||||
for i := 1 to N do
|
||||
begin
|
||||
ypos := vtop + ceil(vhi * ( (MaxY - YValues[i-1,j]) / (MaxY - MinY)));
|
||||
xpos := hleft + ceil(hwide * ( (XValues[i-1,j] - MinX) / (MaxX - MinX)));
|
||||
if (i = 1) then
|
||||
BlankFrm.Image1.Canvas.MoveTo(xpos, ypos);
|
||||
if LinesChk.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;
|
||||
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
|
||||
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 TMultXvsYFrm.UpdateBtnStates;
|
||||
var
|
||||
lSelected: Boolean;
|
||||
i: Integer;
|
||||
begin
|
||||
lSelected := false;
|
||||
for i:=0 to VarList.Items.Count-1 do
|
||||
if VarList.Selected[i] then
|
||||
begin
|
||||
lSelected := true;
|
||||
break;
|
||||
end;
|
||||
|
||||
XInBtn.Enabled := lSelected and (XEdit.Text = '');
|
||||
YInBtn.Enabled := lSelected and (YEdit.Text = '');
|
||||
GroupInBtn.Enabled := lSelected and (GroupEdit.Text = '');
|
||||
XOutBtn.Enabled := (XEdit.Text <> '');
|
||||
YOutBtn.Enabled := (YEdit.Text <> '');
|
||||
GroupOutBtn.Enabled := (GroupEdit.Text <> '');
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
Reference in New Issue
Block a user