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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,379 +1,374 @@
object XvsMultYForm: TXvsMultYForm object XvsMultYForm: TXvsMultYForm
Left = 288 Left = 288
Height = 467 Height = 500
Top = 117 Top = 117
Width = 452 Width = 1000
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/PlotXVersusMultipleYValues.htm' HelpKeyword = 'html/PlotXVersusMultipleYValues.htm'
Caption = 'X vs Multiple Y Plot' Caption = 'X vs Multiple Y Plot'
ClientHeight = 467 ClientHeight = 500
ClientWidth = 452 ClientWidth = 1000
OnActivate = FormActivate OnActivate = FormActivate
OnCreate = FormCreate OnCreate = FormCreate
OnShow = ResetBtnClick OnShow = ResetBtnClick
Position = poMainFormCenter Position = poMainFormCenter
LCLVersion = '2.1.0.0' LCLVersion = '2.1.0.0'
object Label4: TLabel object ParamsPanel: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = PlotTitleEdit
AnchorSideTop.Side = asrCenter
Left = 8 Left = 8
Height = 15 Height = 484
Top = 332 Top = 8
Width = 49 Width = 296
BorderSpacing.Left = 8 Align = alLeft
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
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Bottom = 8 BorderSpacing.Right = 4
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.Bottom = 8 BorderSpacing.Bottom = 8
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 214 ClientHeight = 484
ClientWidth = 436 ClientWidth = 296
Constraints.MinHeight = 200
TabOrder = 0 TabOrder = 0
object Label1: TLabel object Panel1: TPanel
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Panel1 AnchorSideTop.Control = ParamsPanel
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = PlotTitleEdit
Left = 0 Left = 0
Height = 15 Height = 345
Top = 0 Top = 0
Width = 49 Width = 296
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
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2 BorderSpacing.Bottom = 8
BorderSpacing.Right = 8 BevelOuter = bvNone
ItemHeight = 0 ClientHeight = 345
MultiSelect = True ClientWidth = 296
OnSelectionChange = VarListSelectionChange
TabOrder = 0 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 end
object XInBtn: TBitBtn object CloseBtn: TButton
AnchorSideLeft.Control = Panel1 AnchorSideRight.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideRight.Side = asrBottom
AnchorSideTop.Control = VarList AnchorSideBottom.Control = ParamsPanel
Left = 204 AnchorSideBottom.Side = asrBottom
Height = 28 Left = 241
Top = 17 Height = 25
Width = 28 Top = 459
Images = MainDataModule.ImageList Width = 55
ImageIndex = 1 Anchors = [akRight, akBottom]
OnClick = XInBtnClick AutoSize = True
Spacing = 0 BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Close'
ModalResult = 11
OnClick = CloseBtnClick
TabOrder = 1 TabOrder = 1
end end
object XOutBtn: TBitBtn object ComputeBtn: TButton
AnchorSideLeft.Control = Panel1 AnchorSideRight.Control = CloseBtn
AnchorSideLeft.Side = asrCenter AnchorSideBottom.Control = ParamsPanel
AnchorSideTop.Control = XInBtn AnchorSideBottom.Side = asrBottom
AnchorSideTop.Side = asrBottom Left = 157
Left = 204 Height = 25
Height = 28 Top = 459
Top = 49 Width = 76
Width = 28 Anchors = [akRight, akBottom]
BorderSpacing.Top = 4 AutoSize = True
Images = MainDataModule.ImageList BorderSpacing.Left = 8
ImageIndex = 0 BorderSpacing.Top = 8
OnClick = XOutBtnClick BorderSpacing.Right = 8
Spacing = 0 Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 2 TabOrder = 2
end end
object YInBtn: TBitBtn object ResetBtn: TButton
AnchorSideLeft.Control = Panel1 AnchorSideRight.Control = ComputeBtn
AnchorSideLeft.Side = asrCenter AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Control = Bevel1 AnchorSideBottom.Side = asrBottom
Left = 204 Left = 95
Height = 28 Height = 25
Top = 133 Top = 459
Width = 28 Width = 54
Anchors = [akLeft, akBottom] Anchors = [akRight, akBottom]
Images = MainDataModule.ImageList AutoSize = True
ImageIndex = 1 BorderSpacing.Left = 8
OnClick = YInBtnClick BorderSpacing.Top = 8
Spacing = 0 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 TabOrder = 4
end end
object YOutBtn: TBitBtn object GroupBox1: TGroupBox
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideBottom.Control = Bevel2
AnchorSideTop.Control = Bevel1 Left = 0
AnchorSideTop.Side = asrBottom Height = 51
Left = 204 Top = 384
Height = 28 Width = 185
Top = 165 Anchors = [akLeft, akBottom]
Width = 28 AutoSize = True
Images = MainDataModule.ImageList BorderSpacing.Top = 8
ImageIndex = 0 BorderSpacing.Bottom = 8
OnClick = YOutBtnClick Caption = 'Options'
Spacing = 0 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 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 end
object Label2: TLabel object Label4: TLabel
AnchorSideLeft.Control = XEdit AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = XEdit AnchorSideTop.Control = PlotTitleEdit
Left = 240 AnchorSideTop.Side = asrCenter
Left = 8
Height = 15 Height = 15
Top = 25 Top = 357
Width = 54 Width = 49
Anchors = [akLeft, akBottom] Caption = 'Plot Title:'
BorderSpacing.Bottom = 2
Caption = 'X Variable:'
ParentColor = False ParentColor = False
end end
object Label3: TLabel object PlotTitleEdit: TEdit
AnchorSideLeft.Control = YBox AnchorSideLeft.Control = Label4
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
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1 AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = XOutBtn AnchorSideBottom.Control = GroupBox1
AnchorSideBottom.Side = asrBottom Left = 65
Left = 240
Height = 23 Height = 23
Top = 42 Top = 353
Width = 196 Width = 231
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8 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 TabOrder = 6
end TextHint = 'Title above the chart'
object Bevel1: TBevel
AnchorSideTop.Control = YBox
AnchorSideTop.Side = asrCenter
Left = 210
Height = 4
Top = 161
Width = 14
Shape = bsSpacer
end end
end end
object Memo1: TLabel object ParamsSplitter: TSplitter
AnchorSideLeft.Control = Owner Left = 308
AnchorSideTop.Control = Owner Height = 500
AnchorSideRight.Control = Owner Top = 0
AnchorSideRight.Side = asrBottom Width = 5
Left = 8 ResizeStyle = rsPattern
Height = 90 end
object PageControl1: TPageControl
Left = 317
Height = 484
Top = 8 Top = 8
Width = 436 Width = 675
Anchors = [akTop, akLeft, akRight] ActivePage = ReportPage
BorderSpacing.Left = 8 Align = alClient
BorderSpacing.Top = 8 BorderSpacing.Left = 4
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
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Reset' TabIndex = 0
OnClick = ResetBtnClick TabOrder = 2
TabOrder = 5 object ReportPage: TTabSheet
end Caption = 'Report'
object Bevel2: TBevel end
AnchorSideLeft.Control = Owner object ChartPage: TTabSheet
AnchorSideRight.Control = Owner Caption = 'Chart'
AnchorSideRight.Side = asrBottom end
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
end end
end end

View File

@@ -3,33 +3,35 @@
unit XvsMultYUnit; unit XvsMultYUnit;
{$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, Buttons, ExtCtrls, Printers, StdCtrls, Buttons, ExtCtrls, Printers, ComCtrls,
MainUnit, Globals, ContextHelpUnit, OutputUnit, DataProcs, MatrixLib; MainUnit, Globals, ContextHelpUnit, DataProcs, MatrixLib,
ReportFrameUnit, ChartFrameUnit;
type type
{ TXvsMultYForm } { TXvsMultYForm }
TXvsMultYForm = class(TForm) TXvsMultYForm = class(TForm)
Bevel1: TBevel;
Bevel2: TBevel; Bevel2: TBevel;
LinesBox: TCheckBox; LinesBox: TCheckBox;
DescChk: TCheckBox;
GroupBox1: TGroupBox; GroupBox1: TGroupBox;
Memo1: TLabel; PageControl1: TPageControl;
Panel1: TPanel; Panel1: TPanel;
ParamsPanel: TPanel;
ResetBtn: TButton; ResetBtn: TButton;
ComputeBtn: TButton; ComputeBtn: TButton;
CloseBtn: TButton; CloseBtn: TButton;
PlotTitleEdit: TEdit; PlotTitleEdit: TEdit;
Label4: TLabel; Label4: TLabel;
HelpBtn: TButton; HelpBtn: TButton;
ParamsSplitter: TSplitter;
ReportPage: TTabSheet;
ChartPage: TTabSheet;
YBox: TListBox; YBox: TListBox;
XEdit: TEdit; XEdit: TEdit;
Label2: TLabel; Label2: TLabel;
@@ -46,6 +48,7 @@ type
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure HelpBtnClick(Sender: TObject); procedure HelpBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject); procedure ResetBtnClick(Sender: TObject);
procedure VarListDblClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; User: boolean); procedure VarListSelectionChange(Sender: TObject; User: boolean);
procedure XInBtnClick(Sender: TObject); procedure XInBtnClick(Sender: TObject);
procedure XOutBtnClick(Sender: TObject); procedure XOutBtnClick(Sender: TObject);
@@ -53,14 +56,11 @@ type
procedure YOutBtnClick(Sender: TObject); procedure YOutBtnClick(Sender: TObject);
private private
{ private declarations } { private declarations }
FReportFrame: TReportFrame;
FChartFrame: TChartFrame;
FAutoSized: Boolean; FAutoSized: Boolean;
selected: IntDyneVec; selected: IntDyneVec;
{$IFDEF USE_TACHART}
procedure PlotXY(XValues: DblDyneVec; YValues: DblDyneMat); procedure PlotXY(XValues: DblDyneVec; YValues: DblDyneMat);
{$ELSE}
procedure PlotXY(XValues: DblDyneVec; YValues: DblDyneMat;
MaxX, MinX, MaxY, MinY: double; N, NoY: integer);
{$ENDIF}
procedure UpdateBtnStates; procedure UpdateBtnStates;
public public
{ public declarations } { public declarations }
@@ -70,50 +70,27 @@ type
var var
XvsMultYForm: TXvsMultYForm; XvsMultYForm: TXvsMultYForm;
implementation implementation
{$R *.lfm} {$R *.lfm}
uses uses
{$IFDEF USE_TACHART}
TAChartUtils, TAChartUtils,
ChartFrameUnit, ChartUnit,
{$ELSE}
BlankFrmUnit,
{$ENDIF}
Math, Utils; Math, Utils;
{ TXvsMultYForm } { TXvsMultYForm }
procedure TXvsMultYForm.Reset; procedure TXvsMultYForm.CloseBtnClick(Sender: TObject);
var
i: integer;
begin begin
VarList.Clear; Close;
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; end;
procedure TXvsMultYForm.ResetBtnClick(Sender: TObject);
begin
Reset;
end;
procedure TXvsMultYForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
procedure TXvsMultYForm.ComputeBtnClick(Sender: TObject); procedure TXvsMultYForm.ComputeBtnClick(Sender: TObject);
var var
i, j, k, N, NoY, XCol, NoSelected: integer; i, j, N, NoY, XCol, NoSelected: integer;
MinX, MaxX, MinY, MaxY: double; MinX, MaxX, MinY, MaxY: double;
Title: string; Title: string;
RMatrix: DblDyneMat = nil; RMatrix: DblDyneMat = nil;
@@ -216,30 +193,27 @@ begin
end; end;
// get descriptive data // get descriptive data
if DescChk.Checked then lReport.Add('X VERSUS MULTIPLE Y VALUES PLOT');
begin lReport.Add('');
lReport.Add('X VERSUS MULTIPLE Y VALUES PLOT');
lReport.Add('');
Correlations(NoSelected,selected,RMatrix,Means,Variances,StdDevs,errorcode,Ncases); Correlations(NoSelected,selected,RMatrix,Means,Variances,StdDevs,errorcode,Ncases);
//N := Ncases; //N := Ncases;
Title := 'CORRELATIONS'; Title := 'CORRELATIONS';
MatPrint(RMatrix, NoSelected, NoSelected, Title, RowLabels, ColLabels, N, lReport); MatPrint(RMatrix, NoSelected, NoSelected, Title, RowLabels, ColLabels, N, lReport);
Title := 'Means'; Title := 'Means';
DynVectorPrint(Means, NoSelected, Title, RowLabels, N, lReport); DynVectorPrint(Means, NoSelected, Title, RowLabels, N, lReport);
Title := 'Variances'; Title := 'Variances';
DynVectorPrint(Variances, NoSelected, Title, RowLabels, N, lReport); DynVectorPrint(Variances, NoSelected, Title, RowLabels, N, lReport);
Title := 'Standard Deviations'; Title := 'Standard Deviations';
DynVectorPrint(StdDevs, NoSelected, Title, RowLabels, N, lReport); DynVectorPrint(StdDevs, NoSelected, Title, RowLabels, N, lReport);
DisplayReport(lReport); FReportFrame.DisplayReport(lReport);
end;
// Sort on X // Sort on X
SortOnX(XValues, YValues); SortOnX(XValues, YValues);
// Plot x vs multiple y // Plot x vs multiple y
PlotXY(XValues, YValues{$IFNDEF USE_TACHART}, MaxX, MinX, MaxY, MinY, N, NoY{$ENDIF}); PlotXY(XValues, YValues);
finally finally
lReport.Free; lReport.Free;
@@ -256,12 +230,6 @@ begin
end; end;
procedure TXvsMultYForm.CloseBtnClick(Sender: TObject);
begin
Close;
end;
procedure TXvsMultYForm.FormActivate(Sender: TObject); procedure TXvsMultYForm.FormActivate(Sender: TObject);
var var
w: Integer; w: Integer;
@@ -275,8 +243,16 @@ begin
ComputeBtn.Constraints.MinWidth := w; ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w; CloseBtn.Constraints.MinWidth := w;
Constraints.MinWidth := Width; Panel1.Constraints.MinHeight := YOutBtn.Top + YOutBtn.Height;
Constraints.MinHeight := 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; Position := poDesigned;
FAutoSized := true; FAutoSized := true;
@@ -286,6 +262,20 @@ end;
procedure TXvsMultYForm.FormCreate(Sender: TObject); procedure TXvsMultYForm.FormCreate(Sender: TObject);
begin begin
Assert(OS3MainFrm <> nil); 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; Reset;
end; end;
@@ -298,6 +288,95 @@ begin
end; 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); procedure TXvsMultYForm.XInBtnClick(Sender: TObject);
var var
index: integer; index: integer;
@@ -361,170 +440,5 @@ begin
end; 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. end.

View File

@@ -171,6 +171,9 @@ procedure TBasicSPCForm.FormCreate(Sender: TObject);
begin begin
Assert(OS3MainFrm <> nil); Assert(OS3MainFrm <> nil);
Width := Scale96ToFont(DEFAULT_WIDTH);
Height := Scale96ToFont(DEFAULT_HEIGHT);
FReportFrame := TReportFrame.Create(self); FReportFrame := TReportFrame.Create(self);
FReportFrame.Parent := ReportPage; FReportFrame.Parent := ReportPage;
FReportFrame.Align := alClient; 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 (*.*)|*.*'; 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 (*.*)|*.*'; SSV_FILE_FILTER = 'Space field files (*.ssv)|*.ssv;*.SSV|Text files (*.txt)|*.txt;*.TXT|All files (*.*)|*.*';
DEFAULT_WIDTH = 1000;
DEFAULT_HEIGHT = 500;
implementation implementation
end. end.