LazStats: Integrate report and chart into form of BubblePlotUnit.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7685 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-09-22 09:40:36 +00:00
parent d9150100d0
commit 0bb1c4fe0f
5 changed files with 543 additions and 582 deletions

View File

@ -375,8 +375,8 @@ begin
Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + ParamsPanel.BorderSpacing.Around*2; Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + ParamsPanel.BorderSpacing.Around*2;
Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 200; Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 200;
if Height < Constraints.MinHeight then Height := 1; // Enforce autosizing if Height < Constraints.MinHeight then Height := 1; // enforce auto-sizing
if Width < Constraints.MinWidth then Width := 1; if Width < Constraints.MiNWidth then Width := 1;
Position := poDesigned; Position := poDesigned;
FAutoSized := true; FAutoSized := true;
@ -399,7 +399,6 @@ begin
FChartFrame.Chart.Legend.TextFormat := tfHTML; FChartFrame.Chart.Legend.TextFormat := tfHTML;
FChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80; FChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80;
FChartFrame.Chart.BottomAxis.Intervals.MinLength := 30; FChartFrame.Chart.BottomAxis.Intervals.MinLength := 30;
InitToolbar(FChartFrame.ChartToolbar, tpTop);
Reset; Reset;
end; end;
@ -542,9 +541,9 @@ begin
MeasEdit.Text := VarList.Items[index] MeasEdit.Text := VarList.Items[index]
else else
GroupEdit.Text := VarList.Items[index]; GroupEdit.Text := VarList.Items[index];
VarList.Items.Delete(index);
UpdateBtnStates;
end; end;
VarList.Items.Delete(index);
UpdateBtnStates;
end; end;

View File

@ -1,488 +1,522 @@
object BubbleForm: TBubbleForm object BubbleForm: TBubbleForm
Left = 476 Left = 476
Height = 454 Height = 465
Top = 224 Top = 224
Width = 500 Width = 937
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/RepeatedMeasuresBubblePlot.htm' HelpKeyword = 'html/RepeatedMeasuresBubblePlot.htm'
AutoSize = True
Caption = 'Repeated Measures Bubble Plot' Caption = 'Repeated Measures Bubble Plot'
ClientHeight = 454 ClientHeight = 465
ClientWidth = 500 ClientWidth = 937
OnActivate = FormActivate OnActivate = FormActivate
OnCreate = FormCreate OnCreate = FormCreate
Position = poMainFormCenter Position = poMainFormCenter
LCLVersion = '2.1.0.0' LCLVersion = '2.1.0.0'
object Label6: TLabel object ParamsPanel: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = TitleEdit
AnchorSideTop.Side = asrCenter
Left = 8 Left = 8
Height = 15 Height = 449
Top = 316
Width = 55
BorderSpacing.Left = 8
Caption = 'Main Title:'
ParentColor = False
end
object Label7: TLabel
AnchorSideTop.Control = XLabelEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = XLabelEdit
Left = 22
Height = 15
Top = 347
Width = 41
Anchors = [akTop, akRight]
BorderSpacing.Right = 8
Caption = 'X Label:'
ParentColor = False
end
object Label8: TLabel
AnchorSideTop.Control = YLabelEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = YLabelEdit
Left = 293
Height = 15
Top = 347
Width = 41
Anchors = [akTop, akRight]
BorderSpacing.Right = 8
Caption = 'Y Label:'
ParentColor = False
end
object TitleEdit: TEdit
AnchorSideLeft.Control = Label6
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = XLabelEdit
Left = 71
Height = 23
Top = 312
Width = 421
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Bottom = 8
TabOrder = 1
TextHint = 'Title of the Diagram'
end
object XLabelEdit: TEdit
AnchorSideLeft.Control = TitleEdit
AnchorSideBottom.Control = TransformChk
Left = 71
Height = 23
Top = 343
Width = 150
Anchors = [akLeft, akBottom]
TabOrder = 2
TextHint = 'X Axis Title'
end
object YLabelEdit: TEdit
AnchorSideTop.Control = XLabelEdit
AnchorSideRight.Control = TitleEdit
AnchorSideRight.Side = asrBottom
Left = 342
Height = 23
Top = 343
Width = 150
Anchors = [akTop, akRight]
TabOrder = 3
TextHint = 'Y Axis Title'
end
object TransformChk: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 19
Top = 378
Width = 365
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 12
BorderSpacing.Bottom = 8
Caption = 'Transform Data Grid for ANOVA (Treatments by Subjects ANOVA)'
TabOrder = 4
end
object Panel1: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = TitleEdit
Left = 8
Height = 296
Top = 8 Top = 8
Width = 484 Width = 376
Anchors = [akTop, akLeft, akRight, akBottom] Align = alLeft
AutoSize = True
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 4
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 296 ClientHeight = 449
ClientWidth = 484 ClientWidth = 376
TabOrder = 0 TabOrder = 0
object Label1: TLabel object Panel1: TPanel
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Panel1 AnchorSideTop.Control = ParamsPanel
Left = 0 AnchorSideRight.Control = ParamsPanel
Height = 15
Top = 0
Width = 49
Caption = 'Variables:'
ParentColor = False
end
object Label2: TLabel
AnchorSideLeft.Control = BubbleEdit
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = BubbleEdit AnchorSideBottom.Control = TitleEdit
Left = 264
Height = 15
Top = 23
Width = 201
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Bubble Identification Number Variable'
ParentColor = False
end
object Label3: TLabel
AnchorSideLeft.Control = XEdit
AnchorSideBottom.Control = XEdit
Left = 264
Height = 15
Top = 97
Width = 82
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'X Value Variable'
ParentColor = False
end
object Label4: TLabel
AnchorSideLeft.Control = YEdit
AnchorSideBottom.Control = YEdit
Left = 264
Height = 15
Top = 171
Width = 82
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Y Value Variable'
ParentColor = False
end
object Label5: TLabel
AnchorSideLeft.Control = SizeEdit
AnchorSideBottom.Control = SizeEdit
Left = 264
Height = 15
Top = 245
Width = 104
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Bubble Size Variable'
ParentColor = False
end
object VarList: TListBox
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = IDInBtn
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 279 Height = 288
Top = 17 Top = 0
Width = 220 Width = 376
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2 BorderSpacing.Bottom = 8
BorderSpacing.Right = 8 BevelOuter = bvNone
ItemHeight = 0 ClientHeight = 288
OnSelectionChange = VarListSelectionChange ClientWidth = 376
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 Label2: TLabel
AnchorSideLeft.Control = BubbleEdit
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = BubbleEdit
Left = 209
Height = 15
Top = 19
Width = 154
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Bubble Identification Variable'
ParentColor = False
end
object Label3: TLabel
AnchorSideLeft.Control = XEdit
AnchorSideBottom.Control = XEdit
Left = 209
Height = 15
Top = 89
Width = 82
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'X Value Variable'
ParentColor = False
end
object Label4: TLabel
AnchorSideLeft.Control = YEdit
AnchorSideBottom.Control = YEdit
Left = 209
Height = 15
Top = 159
Width = 82
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Y Value Variable'
ParentColor = False
end
object Label5: TLabel
AnchorSideLeft.Control = SizeEdit
AnchorSideBottom.Control = SizeEdit
Left = 209
Height = 15
Top = 229
Width = 104
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Bubble Size Variable'
ParentColor = False
end
object VarList: TListBox
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = IDInBtn
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 271
Top = 17
Width = 167
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0
OnDblClick = VarListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 0
end
object IDInBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 175
Height = 26
Top = 17
Width = 26
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = IDInBtnClick
Spacing = 0
TabOrder = 1
end
object IDOutBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = IDInBtn
AnchorSideTop.Side = asrBottom
Left = 175
Height = 26
Top = 45
Width = 26
BorderSpacing.Top = 2
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = IDOutBtnClick
Spacing = 0
TabOrder = 2
end
object XInBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = IDOutBtn
AnchorSideTop.Side = asrBottom
Left = 175
Height = 26
Top = 87
Width = 26
BorderSpacing.Top = 16
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = XInBtnClick
Spacing = 0
TabOrder = 4
end
object XOutBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = XInBtn
AnchorSideTop.Side = asrBottom
Left = 175
Height = 26
Top = 115
Width = 26
BorderSpacing.Top = 2
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = XOutBtnClick
Spacing = 0
TabOrder = 5
end
object YInBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = XOutBtn
AnchorSideTop.Side = asrBottom
Left = 175
Height = 26
Top = 157
Width = 26
BorderSpacing.Top = 16
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = YInBtnClick
Spacing = 0
TabOrder = 7
end
object YOutBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = YInBtn
AnchorSideTop.Side = asrBottom
Left = 175
Height = 26
Top = 185
Width = 26
BorderSpacing.Top = 2
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = YOutBtnClick
Spacing = 0
TabOrder = 8
end
object SizeInBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = YOutBtn
AnchorSideTop.Side = asrBottom
Left = 175
Height = 26
Top = 227
Width = 26
BorderSpacing.Top = 16
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = SizeInBtnClick
Spacing = 0
TabOrder = 10
end
object SizeOutBtn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = SizeInBtn
AnchorSideTop.Side = asrBottom
Left = 175
Height = 26
Top = 255
Width = 26
BorderSpacing.Top = 2
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = SizeOutBtnClick
Spacing = 0
TabOrder = 11
end
object BubbleEdit: TEdit
AnchorSideLeft.Control = IDInBtn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = IDOutBtn
AnchorSideBottom.Side = asrBottom
Left = 209
Height = 23
Top = 36
Width = 167
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'BubbleEdit'
end
object XEdit: TEdit
AnchorSideLeft.Control = BubbleEdit
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = XOutBtn
AnchorSideBottom.Side = asrBottom
Left = 209
Height = 23
Top = 106
Width = 167
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 6
Text = 'XEdit'
end
object YEdit: TEdit
AnchorSideLeft.Control = BubbleEdit
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = YOutBtn
AnchorSideBottom.Side = asrBottom
Left = 209
Height = 23
Top = 176
Width = 167
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 9
Text = 'YEdit'
end
object SizeEdit: TEdit
AnchorSideLeft.Control = BubbleEdit
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = SizeOutBtn
AnchorSideBottom.Side = asrBottom
Left = 209
Height = 23
Top = 246
Width = 167
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 12
Text = 'SizeEdit'
end
end end
object IDInBtn: TBitBtn object CloseBtn: TButton
AnchorSideLeft.Control = Panel1 AnchorSideTop.Side = asrBottom
AnchorSideLeft.Side = asrCenter AnchorSideRight.Control = ParamsPanel
AnchorSideTop.Control = VarList AnchorSideRight.Side = asrBottom
Left = 228 AnchorSideBottom.Control = ParamsPanel
Height = 28 AnchorSideBottom.Side = asrBottom
Top = 17 Left = 321
Width = 28 Height = 25
Images = MainDataModule.ImageList Top = 424
ImageIndex = 1 Width = 55
OnClick = IDInBtnClick Anchors = [akRight, akBottom]
Spacing = 0 AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Close'
ModalResult = 11
OnClick = CloseBtnClick
TabOrder = 1 TabOrder = 1
end end
object IDOutBtn: TBitBtn object ComputeBtn: TButton
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = IDInBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 228 AnchorSideRight.Control = CloseBtn
Height = 28 AnchorSideBottom.Control = ParamsPanel
Top = 47 AnchorSideBottom.Side = asrBottom
Width = 28 Left = 237
BorderSpacing.Top = 2 Height = 25
Images = MainDataModule.ImageList Top = 424
ImageIndex = 0 Width = 76
OnClick = IDOutBtnClick Anchors = [akRight, akBottom]
Spacing = 0 AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 2 TabOrder = 2
end end
object XInBtn: TBitBtn object ResetBtn: TButton
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = IDOutBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 228 AnchorSideRight.Control = ComputeBtn
Height = 28 AnchorSideBottom.Control = ParamsPanel
Top = 91 AnchorSideBottom.Side = asrBottom
Width = 28 Left = 175
BorderSpacing.Top = 16 Height = 25
Images = MainDataModule.ImageList Top = 424
ImageIndex = 1 Width = 54
OnClick = XInBtnClick Anchors = [akRight, akBottom]
Spacing = 0 AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 3
end
object HelpBtn: TButton
Tag = 110
AnchorSideRight.Control = ResetBtn
AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom
Left = 116
Height = 25
Top = 424
Width = 51
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 4 TabOrder = 4
end end
object XOutBtn: TBitBtn object Bevel1: TBevel
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideRight.Control = ParamsPanel
AnchorSideTop.Control = XInBtn AnchorSideRight.Side = asrBottom
AnchorSideTop.Side = asrBottom AnchorSideBottom.Control = CloseBtn
Left = 228 Left = 0
Height = 28 Height = 8
Top = 121 Top = 408
Width = 28 Width = 376
BorderSpacing.Top = 2 Anchors = [akLeft, akRight, akBottom]
Images = MainDataModule.ImageList Shape = bsBottomLine
ImageIndex = 0
OnClick = XOutBtnClick
Spacing = 0
TabOrder = 5
end end
object YInBtn: TBitBtn object Label6: TLabel
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideTop.Control = TitleEdit
AnchorSideTop.Control = XOutBtn AnchorSideTop.Side = asrCenter
AnchorSideTop.Side = asrBottom Left = 0
Left = 228 Height = 15
Height = 28 Top = 300
Top = 165 Width = 55
Width = 28 Caption = 'Main Title:'
BorderSpacing.Top = 16 ParentColor = False
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = YInBtnClick
Spacing = 0
TabOrder = 7
end end
object YOutBtn: TBitBtn object Label7: TLabel
AnchorSideLeft.Control = Panel1 AnchorSideTop.Control = XLabelEdit
AnchorSideLeft.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideTop.Control = YInBtn AnchorSideRight.Control = XLabelEdit
AnchorSideTop.Side = asrBottom Left = 14
Left = 228 Height = 15
Height = 28 Top = 327
Top = 195 Width = 41
Width = 28 Anchors = [akTop, akRight]
BorderSpacing.Top = 2 BorderSpacing.Right = 8
Images = MainDataModule.ImageList Caption = 'X Label:'
ImageIndex = 0 ParentColor = False
OnClick = YOutBtnClick
Spacing = 0
TabOrder = 8
end end
object SizeInBtn: TBitBtn object Label8: TLabel
AnchorSideLeft.Control = Panel1 AnchorSideTop.Control = YLabelEdit
AnchorSideLeft.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideTop.Control = YOutBtn AnchorSideRight.Control = YLabelEdit
AnchorSideTop.Side = asrBottom Left = 14
Left = 228 Height = 15
Height = 28 Top = 354
Top = 239 Width = 41
Width = 28 Anchors = [akTop, akRight]
BorderSpacing.Top = 16 BorderSpacing.Right = 8
Images = MainDataModule.ImageList Caption = 'Y Label:'
ImageIndex = 1 ParentColor = False
OnClick = SizeInBtnClick
Spacing = 0
TabOrder = 10
end end
object SizeOutBtn: TBitBtn object TitleEdit: TEdit
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Label6
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = SizeInBtn
AnchorSideTop.Side = asrBottom
Left = 228
Height = 28
Top = 269
Width = 28
BorderSpacing.Top = 2
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = SizeOutBtnClick
Spacing = 0
TabOrder = 11
end
object BubbleEdit: TEdit
AnchorSideLeft.Control = IDInBtn
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Panel1 AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = IDOutBtn AnchorSideBottom.Control = XLabelEdit
AnchorSideBottom.Side = asrBottom Left = 63
Left = 264
Height = 23 Height = 23
Top = 40 Top = 296
Width = 220 Width = 313
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Bottom = 12 TabOrder = 5
ReadOnly = True TextHint = 'Title of the Diagram'
TabOrder = 3
Text = 'BubbleEdit'
end end
object XEdit: TEdit object XLabelEdit: TEdit
AnchorSideLeft.Control = BubbleEdit AnchorSideLeft.Control = TitleEdit
AnchorSideRight.Control = Panel1 AnchorSideRight.Control = TitleEdit
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = XOutBtn AnchorSideBottom.Control = YLabelEdit
AnchorSideBottom.Side = asrBottom Left = 63
Left = 264
Height = 23 Height = 23
Top = 114 Top = 323
Width = 220 Width = 313
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Bottom = 12 BorderSpacing.Top = 4
ReadOnly = True
TabOrder = 6 TabOrder = 6
Text = 'XEdit' TextHint = 'X Axis Title'
end end
object YEdit: TEdit object YLabelEdit: TEdit
AnchorSideLeft.Control = BubbleEdit AnchorSideLeft.Control = TitleEdit
AnchorSideRight.Control = Panel1 AnchorSideRight.Control = TitleEdit
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = YOutBtn AnchorSideBottom.Control = TransformChk
AnchorSideBottom.Side = asrBottom Left = 63
Left = 264
Height = 23 Height = 23
Top = 188 Top = 350
Width = 220 Width = 313
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Bottom = 12 BorderSpacing.Top = 4
ReadOnly = True TabOrder = 7
TabOrder = 9 TextHint = 'Y Axis Title'
Text = 'YEdit'
end end
object SizeEdit: TEdit object TransformChk: TCheckBox
AnchorSideLeft.Control = BubbleEdit AnchorSideLeft.Control = ParamsPanel
AnchorSideRight.Control = Panel1 AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = Bevel1
AnchorSideBottom.Control = SizeOutBtn Left = 0
AnchorSideBottom.Side = asrBottom Height = 19
Left = 264 Top = 385
Height = 23 Width = 365
Top = 262 Anchors = [akLeft, akBottom]
Width = 220 BorderSpacing.Top = 12
Anchors = [akLeft, akRight, akBottom] BorderSpacing.Bottom = 4
BorderSpacing.Bottom = 12 Caption = 'Transform Data Grid for ANOVA (Treatments by Subjects ANOVA)'
ReadOnly = True TabOrder = 8
TabOrder = 12
Text = 'SizeEdit'
end end
end end
object CloseBtn: TButton object ParamsSplitter: TSplitter
AnchorSideTop.Side = asrBottom Left = 388
AnchorSideRight.Control = Owner Height = 465
AnchorSideRight.Side = asrBottom Top = 0
AnchorSideBottom.Control = Owner Width = 5
AnchorSideBottom.Side = asrBottom ResizeStyle = rsPattern
Left = 433
Height = 25
Top = 421
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 = 8
end end
object ComputeBtn: TButton object PageControl: TPageControl
AnchorSideTop.Side = asrBottom Left = 397
AnchorSideRight.Control = CloseBtn Height = 449
AnchorSideBottom.Control = Owner Top = 8
AnchorSideBottom.Side = asrBottom Width = 532
Left = 349 ActivePage = ReportPage
Height = 25 Align = alClient
Top = 421 BorderSpacing.Left = 4
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Compute' TabIndex = 0
OnClick = ComputeBtnClick TabOrder = 2
TabOrder = 7 object ReportPage: TTabSheet
end Caption = 'Report'
object ResetBtn: TButton end
AnchorSideTop.Side = asrBottom object ChartPage: TTabSheet
AnchorSideRight.Control = ComputeBtn Caption = 'Chart'
AnchorSideBottom.Control = Owner end
AnchorSideBottom.Side = asrBottom
Left = 287
Height = 25
Top = 421
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 6
end
object HelpBtn: TButton
Tag = 110
AnchorSideRight.Control = ResetBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 228
Height = 25
Top = 421
Width = 51
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 12
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 5
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 405
Width = 500
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end end
end end

View File

@ -3,14 +3,13 @@
unit BubblePlotUnit; unit BubblePlotUnit;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
{$I ../../../LazStats.inc}
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Clipbrd, Buttons, ExtCtrls, Math, StdCtrls, Clipbrd, Buttons, ExtCtrls, ComCtrls, Math,
MainUnit, Globals, DataProcs, DictionaryUnit, ContextHelpUnit; MainUnit, Globals, DataProcs, DictionaryUnit, ContextHelpUnit, ChartFrameUnit, ReportFrameUnit;
type type
@ -20,7 +19,12 @@ type
TBubbleForm = class(TForm) TBubbleForm = class(TForm)
Bevel1: TBevel; Bevel1: TBevel;
HelpBtn: TButton; HelpBtn: TButton;
PageControl: TPageControl;
Panel1: TPanel; Panel1: TPanel;
ParamsPanel: TPanel;
ParamsSplitter: TSplitter;
ReportPage: TTabSheet;
ChartPage: TTabSheet;
TransformChk: TCheckBox; TransformChk: TCheckBox;
YLabelEdit: TEdit; YLabelEdit: TEdit;
Label8: TLabel; Label8: TLabel;
@ -59,6 +63,7 @@ type
procedure CloseBtnClick(Sender: TObject); procedure CloseBtnClick(Sender: TObject);
procedure SizeInBtnClick(Sender: TObject); procedure SizeInBtnClick(Sender: TObject);
procedure SizeOutBtnClick(Sender: TObject); procedure SizeOutBtnClick(Sender: TObject);
procedure VarListDblClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean); procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean);
procedure XInBtnClick(Sender: TObject); procedure XInBtnClick(Sender: TObject);
procedure XOutBtnClick(Sender: TObject); procedure XOutBtnClick(Sender: TObject);
@ -68,9 +73,9 @@ type
{ private declarations } { private declarations }
BubbleCol, XCol, YCol, SizeCol: Integer; BubbleCol, XCol, YCol, SizeCol: Integer;
FAutoSized: boolean; FAutoSized: boolean;
procedure PlotBubbles( FReportFrame: TReportFrame;
{$IFNDEF USE_TACHART}NoReplications: Integer; XMax, XMin: Integer;{$ENDIF} FChartFrame: TChartFrame;
YMax, YMin, BubMax, BubMin: Double); procedure PlotBubbles(YMax, YMin, BubMax, BubMin: Double);
procedure UpdateBtnStates; procedure UpdateBtnStates;
public public
{ public declarations } { public declarations }
@ -85,13 +90,8 @@ implementation
{$R *.lfm} {$R *.lfm}
uses uses
{$IFDEF USE_TACHART} TAChartUtils, TALegend, TAMultiSeries,
TAMultiSeries, Utils;
ChartUnit,
{$ELSE}
BlankFrmUnit,
{$ENDIF}
OutputUnit;
{ TBubbleForm } { TBubbleForm }
@ -255,12 +255,10 @@ begin
lReport.Add(' Object %5d Mean: %8.3f', [i+1, CaseSizeMeans[i]]); lReport.Add(' Object %5d Mean: %8.3f', [i+1, CaseSizeMeans[i]]);
// Show the report // Show the report
if DisplayReport(lReport) then FReportFrame.DisplayReport(lReport);
// Plot the bubbles
PlotBubbles( // Plot the bubbles
{$IFNDEF USE_TACHART}NoReplications, XMax, XMin, {$ENDIF} PlotBubbles(YMax, YMin, BubMax, BubMin);
YMax, YMin, BubMax, BubMin
);
finally finally
lReport.Free; lReport.Free;
@ -380,10 +378,17 @@ begin
CloseBtn.Constraints.MinWidth := w; CloseBtn.Constraints.MinWidth := w;
Panel1.Constraints.MinHeight := SizeOutBtn.Top + SizeOutBtn.Height; Panel1.Constraints.MinHeight := SizeOutBtn.Top + SizeOutBtn.Height;
Panel1.Constraints.MinWidth := 2*Label2.Width + IDInBtn.Width + 2*VarList.BorderSpacing.Right; ParamsPanel.Constraints.MinHeight := Panel1.Height + Panel1.BorderSpacing.Bottom +
3*TitleEdit.Height + 2*XLabelEdit.BorderSpacing.Top +
TransformChk.BorderSpacing.Top + TransformChk.Height + TransformChk.BorderSpacing.Bottom +
Bevel1.Height +
CloseBtn.Height + CloseBtn.BorderSpacing.Top;
ParamsPanel.Constraints.MinWidth := Max(TransformChk.Width, 4*w + 3*HelpBtn.BorderSpacing.Right);
Constraints.MinWidth := Width; Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 200;
Constraints.MinHeight := Height; Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + 2*ParamsPanel.BorderSpacing.Top;
if Height < Constraints.MinHeight then Height := 1; // enforce auto-sizing
if Width < Constraints.MiNWidth then Width := 1;
Position := poDesigned; Position := poDesigned;
FAutoSized := True; FAutoSized := True;
@ -394,6 +399,17 @@ procedure TBubbleForm.FormCreate(Sender: TObject);
begin begin
Assert(OS3MainFrm <> nil); Assert(OS3MainFrm <> nil);
if DictionaryFrm = nil then Application.CreateForm(TDictionaryFrm, DictionaryFrm); if DictionaryFrm = nil then Application.CreateForm(TDictionaryFrm, DictionaryFrm);
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;
@ -433,7 +449,6 @@ begin
end; end;
{$IFDEF USE_TACHART}
procedure TBubbleForm.PlotBubbles(YMax, YMin, BubMax, BubMin: Double); procedure TBubbleForm.PlotBubbles(YMax, YMin, BubMax, BubMin: Double);
var var
ser: TBubbleSeries; ser: TBubbleSeries;
@ -447,22 +462,19 @@ begin
yRange := YMax - YMin; yRange := YMax - YMin;
BubRange := BubMax - BubMin; BubRange := BubMax - BubMin;
if ChartForm = nil then FChartFrame.Clear;
ChartForm := TChartForm.Create(Application)
else
ChartForm.Clear;
// Titles // Titles
ChartForm.Caption := 'Bubble Plot of ' + OS3MainFrm.FileNameEdit.Text + LineEnding + TitleEdit.Text; FChartFrame.Caption := 'Bubble Plot of ' + OS3MainFrm.FileNameEdit.Text + LineEnding + TitleEdit.Text;
ChartForm.SetTitle(TitleEdit.Text); FChartFrame.SetTitle(TitleEdit.Text);
if XLabelEdit.Text <> '' then if XLabelEdit.Text <> '' then
ChartForm.SetXTitle(XLabelEdit.Text) FChartFrame.SetXTitle(XLabelEdit.Text)
else else
ChartForm.SetXTitle(XEdit.Text); FChartFrame.SetXTitle(XEdit.Text);
if YLabelEdit.Text <> '' then if YLabelEdit.Text <> '' then
ChartForm.SetYTitle(YLabelEdit.Text) FChartFrame.SetYTitle(YLabelEdit.Text)
else else
ChartForm.SetYTitle(YEdit.Text); FChartFrame.SetYTitle(YEdit.Text);
// Collect bubble IDs and create a bubble series for each unique ID. // Collect bubble IDs and create a bubble series for each unique ID.
bubbleIDs := TStringList.Create; bubbleIDs := TStringList.Create;
@ -475,12 +487,12 @@ begin
end; end;
for i := 0 to bubbleIDs.Count-1 do for i := 0 to bubbleIDs.Count-1 do
begin begin
ser := TBubbleSeries.Create(ChartForm); ser := TBubbleSeries.Create(FChartFrame.Chart);
ser.BubbleBrush.Color := DATA_COLORS[i mod Length(DATA_COLORS)]; ser.BubbleBrush.Color := DATA_COLORS[i mod Length(DATA_COLORS)];
ser.BubbleRadiusUnits := bruY; ser.BubbleRadiusUnits := bruY;
ser.Title := bubbleIDs[i]; ser.Title := bubbleIDs[i];
ser.Tag := StrToInt(bubbleIDs[i]); ser.Tag := StrToInt(bubbleIDs[i]);
ChartForm.Chart.AddSeries(ser); FChartFrame.Chart.AddSeries(ser);
end; end;
finally finally
bubbleIDs.Free; bubbleIDs.Free;
@ -489,11 +501,11 @@ begin
for i := 1 to NoCases do begin for i := 1 to NoCases do begin
id := StrToInt(OS3MainFrm.DataGrid.Cells[BubbleCol, i]); id := StrToInt(OS3MainFrm.DataGrid.Cells[BubbleCol, i]);
// Find the series having this ID // Find the series having this ID
for j := 0 to ChartForm.Chart.SeriesCount-1 do for j := 0 to FChartFrame.Chart.SeriesCount-1 do
if (ChartForm.Chart.Series[j] is TBubbleSeries) and if (FChartFrame.Chart.Series[j] is TBubbleSeries) and
(TBubbleSeries(ChartForm.Chart.Series[j]).Tag = id) then (TBubbleSeries(FChartFrame.Chart.Series[j]).Tag = id) then
begin begin
ser := TBubbleSeries(ChartForm.Chart.Series[j]); ser := TBubbleSeries(FChartFrame.Chart.Series[j]);
break; break;
end; end;
@ -507,113 +519,8 @@ begin
ser.AddXY(xValue, yValue, sizeValue); ser.AddXY(xValue, yValue, sizeValue);
end; end;
ChartForm.Chart.Legend.Visible := true; FChartFrame.Chart.Legend.Visible := true;
ChartForm.Show;
end; end;
{$ELSE}
procedure TBubbleForm.PlotBubbles(NoReplications: Integer;
XMax, XMin: Integer; YMax, YMin, BubMax, BubMin: Double);
var
i, j: Integer;
XLabel, YLabel, Title, valStr, aString: String;
ImageWide, ImageHi, Xstart, Xend, Ystart, Yend, Yincr: integer;
LabelWide, TextHi, Xpos: Integer;
BubColor, place: integer;
X1, Y1, X2, Y2: integer;
dx, dy: Integer;
XRange, XStep: Integer;
YRange, YStep, BubRange: Double;
ratio, value: Double;
intCell: Integer;
xValue, cellvalue: Double;
yProp: Integer;
begin
if BlankFrm = nil then
BlankFrm := TBlankFrm.Create(Application);
XRange := Xmax - Xmin;
XStep := XRange div (NoReplications - 1);
YRange := Ymax - Ymin;
YStep := Yrange / 10;
BubRange := BubMax - BubMin;
BlankFrm.Show;
BlankFrm.Caption := 'BUBBLE PLOT of ' + OS3MainFrm.FileNameEdit.Text;
Xlabel := XlabelEdit.Text;
Ylabel := YlabelEdit.Text;
Title := TitleEdit.Text;
ImageHi := BlankFrm.Image1.Height;
ImageWide := BlankFrm.Image1.Width;
Xstart := ImageWide div 10;
Xend := (ImageWide * 9) div 10;
Ystart := ImageHi div 10;
Yend := (ImageHi * 8) div 10;
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
BlankFrm.Image1.Canvas.Rectangle(0,0,ImageWide,ImageHi);
BlankFrm.Image1.Canvas.FloodFill(0,0,clWhite,fsBorder);
BlankFrm.Image1.Canvas.TextOut(Xstart-10,Ystart-30,Ylabel);
LabelWide := BlankFrm.Image1.Canvas.TextWidth(Xlabel);
BlankFrm.Image1.Canvas.TextOut((Xend-Xstart) div 2 - LabelWide,Yend + 40,Xlabel);
LabelWide := BlankFrm.Image1.Canvas.TextWidth(Title);
BlankFrm.Image1.Canvas.TextOut((Xend-Xstart) div 2 - LabelWide div 2, Ystart - 40,Title);
// draw axis lines
BlankFrm.Image1.Canvas.MoveTo(Xstart,Yend);
BlankFrm.Image1.Canvas.LineTo(Xend,Yend);
BlankFrm.Image1.Canvas.MoveTo(Xstart,Yend);
BlankFrm.Image1.Canvas.LineTo(Xstart,Ystart);
// create y axis values
Yincr := (Yend - Ystart) div 10;
for i := 0 to 10 do // print Y axis values
begin
place := Yend - Yincr * i;
value := Ymin + Ystep * i;
valStr := Format('%.2f', [value]);
TextHi := BlankFrm.Image1.Canvas.TextHeight(valStr);
BlankFrm.Image1.Canvas.TextOut(Xstart-30,place-TextHi, valStr);
end;
// create x axis values
for i := 1 to NoReplications do // print x axis
begin
value := Xmin + ((i-1) * Xstep);
ratio := i / NoReplications;
Xpos := round(ratio * (Xend - Xstart));
valStr := Format('%.0f',[value]);
BlankFrm.Image1.Canvas.TextOut(Xpos,Yend + 20, valStr);
end;
// Plot the bubbles
for i := 1 to NoCases do
begin
intcell := StrToInt(OS3MainFrm.DataGrid.Cells[BubbleCol,i]);
xvalue := StrToFloat(OS3MainFrm.DataGrid.Cells[XCol,i]);
cellvalue := StrToFloat(OS3MainFrm.DataGrid.Cells[YCol,i]);
yprop := Yend - round(((cellvalue-Ymin) / Yrange) * (Yend - Ystart));
cellvalue := StrToFloat(OS3MainFrm.DataGrid.Cells[SizeCol,i]);
astring := Trim(OS3MainFrm.DataGrid.Cells[BubbleCol,i]);
cellvalue := ((cellvalue - BubMin) / BubRange) * 20;
cellvalue := cellvalue + 10;
ratio := ((xvalue - Xmin) / Xstep) + 1;
ratio := (ratio / noreplications) * (Xend - Xstart);
Xpos := ceil(ratio);
BubColor := intcell - 1;
while (Bubcolor > 11) do Bubcolor := 12 - Bubcolor;
BlankFrm.Image1.Canvas.Brush.Color := DATA_COLORS[Bubcolor];
X1 := Xpos - ceil(cellvalue);
Y1 := yprop - ceil(cellvalue);
X2 := Xpos + ceil(cellvalue);
Y2 := yprop + ceil(cellvalue);
BlankFrm.Image1.Canvas.Ellipse(X1,Y1,X2,Y2);
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
dx := BlankFrm.Image1.Canvas.TextWidth(astring) div 2;
dy := BlankFrm.Image1.Canvas.TextHeight(astring) div 2;
BlankFrm.Image1.Canvas.TextOut(Xpos-dx, yprop-dy, astring);
end;
end;
{$ENDIF}
procedure TBubbleForm.Reset; procedure TBubbleForm.Reset;
@ -668,6 +575,26 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBubbleForm.VarListDblClick(Sender: TObject);
var
index: integer;
begin
index := VarList.ItemIndex;
if index > -1 then
begin
if BubbleEdit.Text = '' then
BubbleEdit.Text := VarList.Items[index]
else if XEdit.Text = '' then
XEdit.Text := VarList.Items[index]
else if YEdit.Text = '' then
YEdit.Text := VarList.Items[index]
else
SizeEdit.Text := VarList.Items[index];
VarList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TBubbleForm.UpdateBtnStates; procedure TBubbleForm.UpdateBtnStates;
var var

View File

@ -403,7 +403,6 @@ begin
Marks.Style := smsLabel; Marks.Style := smsLabel;
Grid.Visible := false; Grid.Visible := false;
end; end;
InitToolbar(FChartFrame.ChartToolbar, tpTop);
Reset; Reset;
end; end;

View File

@ -62,7 +62,8 @@ implementation
uses uses
Math, Printers, OSPrinters, Math, Printers, OSPrinters,
TAChartUtils, TADrawerSVG, TAPrint; TAChartUtils, TADrawerSVG, TAPrint,
Utils;
constructor TChartFrame.Create(AOwner: TComponent); constructor TChartFrame.Create(AOwner: TComponent);
@ -72,6 +73,7 @@ begin
ZoomDragTool.LimitToExtent := [zdDown]; ZoomDragTool.LimitToExtent := [zdDown];
PanDragTool.LimitToExtent := [pdDown]; PanDragTool.LimitToExtent := [pdDown];
{$IFEND} {$IFEND}
InitToolbar(ChartToolbar, tpTop);
UpdateBtnStates; UpdateBtnStates;
end; end;