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];
end;
VarList.Items.Delete(index); VarList.Items.Delete(index);
UpdateBtnStates; UpdateBtnStates;
end;
end; end;

View File

@ -1,130 +1,46 @@
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
object Panel1: TPanel
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = ParamsPanel
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = TitleEdit
Left = 0
Height = 288
Top = 0
Width = 376
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Bottom = 8
BevelOuter = bvNone
ClientHeight = 288
ClientWidth = 376
TabOrder = 0 TabOrder = 0
object Label1: TLabel object Label1: TLabel
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
@ -141,21 +57,21 @@ object BubbleForm: TBubbleForm
AnchorSideRight.Control = Panel1 AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = BubbleEdit AnchorSideBottom.Control = BubbleEdit
Left = 264 Left = 209
Height = 15 Height = 15
Top = 23 Top = 19
Width = 201 Width = 154
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2 BorderSpacing.Bottom = 2
Caption = 'Bubble Identification Number Variable' Caption = 'Bubble Identification Variable'
ParentColor = False ParentColor = False
end end
object Label3: TLabel object Label3: TLabel
AnchorSideLeft.Control = XEdit AnchorSideLeft.Control = XEdit
AnchorSideBottom.Control = XEdit AnchorSideBottom.Control = XEdit
Left = 264 Left = 209
Height = 15 Height = 15
Top = 97 Top = 89
Width = 82 Width = 82
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2 BorderSpacing.Bottom = 2
@ -165,9 +81,9 @@ object BubbleForm: TBubbleForm
object Label4: TLabel object Label4: TLabel
AnchorSideLeft.Control = YEdit AnchorSideLeft.Control = YEdit
AnchorSideBottom.Control = YEdit AnchorSideBottom.Control = YEdit
Left = 264 Left = 209
Height = 15 Height = 15
Top = 171 Top = 159
Width = 82 Width = 82
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2 BorderSpacing.Bottom = 2
@ -177,9 +93,9 @@ object BubbleForm: TBubbleForm
object Label5: TLabel object Label5: TLabel
AnchorSideLeft.Control = SizeEdit AnchorSideLeft.Control = SizeEdit
AnchorSideBottom.Control = SizeEdit AnchorSideBottom.Control = SizeEdit
Left = 264 Left = 209
Height = 15 Height = 15
Top = 245 Top = 229
Width = 104 Width = 104
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2 BorderSpacing.Bottom = 2
@ -194,13 +110,14 @@ object BubbleForm: TBubbleForm
AnchorSideBottom.Control = Panel1 AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 279 Height = 271
Top = 17 Top = 17
Width = 220 Width = 167
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 8 BorderSpacing.Right = 8
ItemHeight = 0 ItemHeight = 0
OnDblClick = VarListDblClick
OnSelectionChange = VarListSelectionChange OnSelectionChange = VarListSelectionChange
TabOrder = 0 TabOrder = 0
end end
@ -208,10 +125,10 @@ object BubbleForm: TBubbleForm
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList AnchorSideTop.Control = VarList
Left = 228 Left = 175
Height = 28 Height = 26
Top = 17 Top = 17
Width = 28 Width = 26
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 1 ImageIndex = 1
OnClick = IDInBtnClick OnClick = IDInBtnClick
@ -223,10 +140,10 @@ object BubbleForm: TBubbleForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = IDInBtn AnchorSideTop.Control = IDInBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 228 Left = 175
Height = 28 Height = 26
Top = 47 Top = 45
Width = 28 Width = 26
BorderSpacing.Top = 2 BorderSpacing.Top = 2
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 0 ImageIndex = 0
@ -239,10 +156,10 @@ object BubbleForm: TBubbleForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = IDOutBtn AnchorSideTop.Control = IDOutBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 228 Left = 175
Height = 28 Height = 26
Top = 91 Top = 87
Width = 28 Width = 26
BorderSpacing.Top = 16 BorderSpacing.Top = 16
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 1 ImageIndex = 1
@ -255,10 +172,10 @@ object BubbleForm: TBubbleForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = XInBtn AnchorSideTop.Control = XInBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 228 Left = 175
Height = 28 Height = 26
Top = 121 Top = 115
Width = 28 Width = 26
BorderSpacing.Top = 2 BorderSpacing.Top = 2
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 0 ImageIndex = 0
@ -271,10 +188,10 @@ object BubbleForm: TBubbleForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = XOutBtn AnchorSideTop.Control = XOutBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 228 Left = 175
Height = 28 Height = 26
Top = 165 Top = 157
Width = 28 Width = 26
BorderSpacing.Top = 16 BorderSpacing.Top = 16
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 1 ImageIndex = 1
@ -287,10 +204,10 @@ object BubbleForm: TBubbleForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = YInBtn AnchorSideTop.Control = YInBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 228 Left = 175
Height = 28 Height = 26
Top = 195 Top = 185
Width = 28 Width = 26
BorderSpacing.Top = 2 BorderSpacing.Top = 2
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 0 ImageIndex = 0
@ -303,10 +220,10 @@ object BubbleForm: TBubbleForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = YOutBtn AnchorSideTop.Control = YOutBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 228 Left = 175
Height = 28 Height = 26
Top = 239 Top = 227
Width = 28 Width = 26
BorderSpacing.Top = 16 BorderSpacing.Top = 16
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 1 ImageIndex = 1
@ -319,10 +236,10 @@ object BubbleForm: TBubbleForm
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = SizeInBtn AnchorSideTop.Control = SizeInBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 228 Left = 175
Height = 28 Height = 26
Top = 269 Top = 255
Width = 28 Width = 26
BorderSpacing.Top = 2 BorderSpacing.Top = 2
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 0 ImageIndex = 0
@ -337,10 +254,10 @@ object BubbleForm: TBubbleForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = IDOutBtn AnchorSideBottom.Control = IDOutBtn
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 264 Left = 209
Height = 23 Height = 23
Top = 40 Top = 36
Width = 220 Width = 167
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
@ -354,10 +271,10 @@ object BubbleForm: TBubbleForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = XOutBtn AnchorSideBottom.Control = XOutBtn
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 264 Left = 209
Height = 23 Height = 23
Top = 114 Top = 106
Width = 220 Width = 167
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
ReadOnly = True ReadOnly = True
@ -370,10 +287,10 @@ object BubbleForm: TBubbleForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = YOutBtn AnchorSideBottom.Control = YOutBtn
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 264 Left = 209
Height = 23 Height = 23
Top = 188 Top = 176
Width = 220 Width = 167
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
ReadOnly = True ReadOnly = True
@ -386,10 +303,10 @@ object BubbleForm: TBubbleForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = SizeOutBtn AnchorSideBottom.Control = SizeOutBtn
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 264 Left = 209
Height = 23 Height = 23
Top = 262 Top = 246
Width = 220 Width = 167
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
ReadOnly = True ReadOnly = True
@ -399,90 +316,207 @@ object BubbleForm: TBubbleForm
end end
object CloseBtn: TButton object CloseBtn: TButton
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 433 Left = 321
Height = 25 Height = 25
Top = 421 Top = 424
Width = 55 Width = 55
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
Caption = 'Close' Caption = 'Close'
ModalResult = 11 ModalResult = 11
OnClick = CloseBtnClick OnClick = CloseBtnClick
TabOrder = 8 TabOrder = 1
end end
object ComputeBtn: TButton object ComputeBtn: TButton
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CloseBtn AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 349 Left = 237
Height = 25 Height = 25
Top = 421 Top = 424
Width = 76 Width = 76
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute' Caption = 'Compute'
OnClick = ComputeBtnClick OnClick = ComputeBtnClick
TabOrder = 7 TabOrder = 2
end end
object ResetBtn: TButton object ResetBtn: TButton
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ComputeBtn AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 287 Left = 175
Height = 25 Height = 25
Top = 421 Top = 424
Width = 54 Width = 54
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset' Caption = 'Reset'
OnClick = ResetBtnClick OnClick = ResetBtnClick
TabOrder = 6 TabOrder = 3
end end
object HelpBtn: TButton object HelpBtn: TButton
Tag = 110 Tag = 110
AnchorSideRight.Control = ResetBtn AnchorSideRight.Control = ResetBtn
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = ParamsPanel
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 228 Left = 116
Height = 25 Height = 25
Top = 421 Top = 424
Width = 51 Width = 51
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 12
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Help' Caption = 'Help'
OnClick = HelpBtnClick OnClick = HelpBtnClick
TabOrder = 5 TabOrder = 4
end end
object Bevel1: TBevel object Bevel1: TBevel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideRight.Control = Owner AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn AnchorSideBottom.Control = CloseBtn
Left = 0 Left = 0
Height = 8 Height = 8
Top = 405 Top = 408
Width = 500 Width = 376
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine Shape = bsBottomLine
end end
object Label6: TLabel
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = TitleEdit
AnchorSideTop.Side = asrCenter
Left = 0
Height = 15
Top = 300
Width = 55
Caption = 'Main Title:'
ParentColor = False
end
object Label7: TLabel
AnchorSideTop.Control = XLabelEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = XLabelEdit
Left = 14
Height = 15
Top = 327
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 = 14
Height = 15
Top = 354
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 = 63
Height = 23
Top = 296
Width = 313
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
TabOrder = 5
TextHint = 'Title of the Diagram'
end
object XLabelEdit: TEdit
AnchorSideLeft.Control = TitleEdit
AnchorSideRight.Control = TitleEdit
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = YLabelEdit
Left = 63
Height = 23
Top = 323
Width = 313
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Top = 4
TabOrder = 6
TextHint = 'X Axis Title'
end
object YLabelEdit: TEdit
AnchorSideLeft.Control = TitleEdit
AnchorSideRight.Control = TitleEdit
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = TransformChk
Left = 63
Height = 23
Top = 350
Width = 313
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Top = 4
TabOrder = 7
TextHint = 'Y Axis Title'
end
object TransformChk: TCheckBox
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = Bevel1
Left = 0
Height = 19
Top = 385
Width = 365
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 12
BorderSpacing.Bottom = 4
Caption = 'Transform Data Grid for ANOVA (Treatments by Subjects ANOVA)'
TabOrder = 8
end
end
object ParamsSplitter: TSplitter
Left = 388
Height = 465
Top = 0
Width = 5
ResizeStyle = rsPattern
end
object PageControl: TPageControl
Left = 397
Height = 449
Top = 8
Width = 532
ActivePage = ReportPage
Align = alClient
BorderSpacing.Left = 4
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
TabIndex = 0
TabOrder = 2
object ReportPage: TTabSheet
Caption = 'Report'
end
object ChartPage: TTabSheet
Caption = 'Chart'
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 // Plot the bubbles
PlotBubbles( PlotBubbles(YMax, YMin, BubMax, BubMin);
{$IFNDEF USE_TACHART}NoReplications, XMax, XMin, {$ENDIF}
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;