diff --git a/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.pas b/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.pas index e6839f10c..111d029fb 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.pas @@ -375,8 +375,8 @@ begin Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + ParamsPanel.BorderSpacing.Around*2; Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 200; - if Height < Constraints.MinHeight then Height := 1; // Enforce autosizing - if Width < Constraints.MinWidth then Width := 1; + if Height < Constraints.MinHeight then Height := 1; // enforce auto-sizing + if Width < Constraints.MiNWidth then Width := 1; Position := poDesigned; FAutoSized := true; @@ -399,7 +399,6 @@ begin FChartFrame.Chart.Legend.TextFormat := tfHTML; FChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80; FChartFrame.Chart.BottomAxis.Intervals.MinLength := 30; - InitToolbar(FChartFrame.ChartToolbar, tpTop); Reset; end; @@ -542,9 +541,9 @@ begin MeasEdit.Text := VarList.Items[index] else GroupEdit.Text := VarList.Items[index]; + VarList.Items.Delete(index); + UpdateBtnStates; end; - VarList.Items.Delete(index); - UpdateBtnStates; end; diff --git a/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.lfm index af4011f75..05e7fb3b7 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.lfm @@ -1,488 +1,522 @@ object BubbleForm: TBubbleForm Left = 476 - Height = 454 + Height = 465 Top = 224 - Width = 500 + Width = 937 HelpType = htKeyword HelpKeyword = 'html/RepeatedMeasuresBubblePlot.htm' - AutoSize = True Caption = 'Repeated Measures Bubble Plot' - ClientHeight = 454 - ClientWidth = 500 + ClientHeight = 465 + ClientWidth = 937 OnActivate = FormActivate OnCreate = FormCreate Position = poMainFormCenter LCLVersion = '2.1.0.0' - object Label6: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = TitleEdit - AnchorSideTop.Side = asrCenter + object ParamsPanel: TPanel Left = 8 - Height = 15 - 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 + Height = 449 Top = 8 - Width = 484 - Anchors = [akTop, akLeft, akRight, akBottom] - AutoSize = True + Width = 376 + Align = alLeft BorderSpacing.Left = 8 BorderSpacing.Top = 8 - BorderSpacing.Right = 8 + BorderSpacing.Right = 4 BorderSpacing.Bottom = 8 BevelOuter = bvNone - ClientHeight = 296 - ClientWidth = 484 + ClientHeight = 449 + ClientWidth = 376 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 + object Panel1: TPanel + AnchorSideLeft.Control = ParamsPanel + AnchorSideTop.Control = ParamsPanel + AnchorSideRight.Control = ParamsPanel AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = BubbleEdit - 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 + AnchorSideBottom.Control = TitleEdit Left = 0 - Height = 279 - Top = 17 - Width = 220 + Height = 288 + Top = 0 + Width = 376 Anchors = [akTop, akLeft, akRight, akBottom] - BorderSpacing.Top = 2 - BorderSpacing.Right = 8 - ItemHeight = 0 - OnSelectionChange = VarListSelectionChange + BorderSpacing.Bottom = 8 + BevelOuter = bvNone + ClientHeight = 288 + ClientWidth = 376 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 - object IDInBtn: TBitBtn - AnchorSideLeft.Control = Panel1 - AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = VarList - Left = 228 - Height = 28 - Top = 17 - Width = 28 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = IDInBtnClick - Spacing = 0 + object CloseBtn: TButton + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = ParamsPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = ParamsPanel + AnchorSideBottom.Side = asrBottom + Left = 321 + Height = 25 + Top = 424 + Width = 55 + Anchors = [akRight, akBottom] + AutoSize = True + BorderSpacing.Left = 8 + BorderSpacing.Top = 8 + Caption = 'Close' + ModalResult = 11 + OnClick = CloseBtnClick TabOrder = 1 end - object IDOutBtn: TBitBtn - AnchorSideLeft.Control = Panel1 - AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = IDInBtn + object ComputeBtn: TButton AnchorSideTop.Side = asrBottom - Left = 228 - Height = 28 - Top = 47 - Width = 28 - BorderSpacing.Top = 2 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = IDOutBtnClick - Spacing = 0 + AnchorSideRight.Control = CloseBtn + AnchorSideBottom.Control = ParamsPanel + AnchorSideBottom.Side = asrBottom + Left = 237 + Height = 25 + Top = 424 + Width = 76 + Anchors = [akRight, akBottom] + AutoSize = True + BorderSpacing.Top = 8 + BorderSpacing.Right = 8 + Caption = 'Compute' + OnClick = ComputeBtnClick TabOrder = 2 end - object XInBtn: TBitBtn - AnchorSideLeft.Control = Panel1 - AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = IDOutBtn + object ResetBtn: TButton AnchorSideTop.Side = asrBottom - Left = 228 - Height = 28 - Top = 91 - Width = 28 - BorderSpacing.Top = 16 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = XInBtnClick - Spacing = 0 + AnchorSideRight.Control = ComputeBtn + AnchorSideBottom.Control = ParamsPanel + AnchorSideBottom.Side = asrBottom + Left = 175 + Height = 25 + Top = 424 + Width = 54 + Anchors = [akRight, akBottom] + 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 end - object XOutBtn: TBitBtn - AnchorSideLeft.Control = Panel1 - AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = XInBtn - AnchorSideTop.Side = asrBottom - Left = 228 - Height = 28 - Top = 121 - Width = 28 - BorderSpacing.Top = 2 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = XOutBtnClick - Spacing = 0 - TabOrder = 5 + object Bevel1: TBevel + AnchorSideLeft.Control = ParamsPanel + AnchorSideRight.Control = ParamsPanel + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = CloseBtn + Left = 0 + Height = 8 + Top = 408 + Width = 376 + Anchors = [akLeft, akRight, akBottom] + Shape = bsBottomLine end - object YInBtn: TBitBtn - AnchorSideLeft.Control = Panel1 - AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = XOutBtn - AnchorSideTop.Side = asrBottom - Left = 228 - Height = 28 - Top = 165 - Width = 28 - BorderSpacing.Top = 16 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = YInBtnClick - Spacing = 0 - TabOrder = 7 + 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 YOutBtn: TBitBtn - AnchorSideLeft.Control = Panel1 - AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = YInBtn - AnchorSideTop.Side = asrBottom - Left = 228 - Height = 28 - Top = 195 - Width = 28 - BorderSpacing.Top = 2 - Images = MainDataModule.ImageList - ImageIndex = 0 - OnClick = YOutBtnClick - Spacing = 0 - TabOrder = 8 + 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 SizeInBtn: TBitBtn - AnchorSideLeft.Control = Panel1 - AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = YOutBtn - AnchorSideTop.Side = asrBottom - Left = 228 - Height = 28 - Top = 239 - Width = 28 - BorderSpacing.Top = 16 - Images = MainDataModule.ImageList - ImageIndex = 1 - OnClick = SizeInBtnClick - Spacing = 0 - TabOrder = 10 + 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 SizeOutBtn: TBitBtn - AnchorSideLeft.Control = Panel1 - 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 + object TitleEdit: TEdit + AnchorSideLeft.Control = Label6 AnchorSideLeft.Side = asrBottom + AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Panel1 AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = IDOutBtn - AnchorSideBottom.Side = asrBottom - Left = 264 + AnchorSideBottom.Control = XLabelEdit + Left = 63 Height = 23 - Top = 40 - Width = 220 + Top = 296 + Width = 313 Anchors = [akLeft, akRight, akBottom] BorderSpacing.Left = 8 - BorderSpacing.Bottom = 12 - ReadOnly = True - TabOrder = 3 - Text = 'BubbleEdit' + TabOrder = 5 + TextHint = 'Title of the Diagram' end - object XEdit: TEdit - AnchorSideLeft.Control = BubbleEdit - AnchorSideRight.Control = Panel1 + object XLabelEdit: TEdit + AnchorSideLeft.Control = TitleEdit + AnchorSideRight.Control = TitleEdit AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = XOutBtn - AnchorSideBottom.Side = asrBottom - Left = 264 + AnchorSideBottom.Control = YLabelEdit + Left = 63 Height = 23 - Top = 114 - Width = 220 + Top = 323 + Width = 313 Anchors = [akLeft, akRight, akBottom] - BorderSpacing.Bottom = 12 - ReadOnly = True + BorderSpacing.Top = 4 TabOrder = 6 - Text = 'XEdit' + TextHint = 'X Axis Title' end - object YEdit: TEdit - AnchorSideLeft.Control = BubbleEdit - AnchorSideRight.Control = Panel1 + object YLabelEdit: TEdit + AnchorSideLeft.Control = TitleEdit + AnchorSideRight.Control = TitleEdit AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = YOutBtn - AnchorSideBottom.Side = asrBottom - Left = 264 + AnchorSideBottom.Control = TransformChk + Left = 63 Height = 23 - Top = 188 - Width = 220 + Top = 350 + Width = 313 Anchors = [akLeft, akRight, akBottom] - BorderSpacing.Bottom = 12 - ReadOnly = True - TabOrder = 9 - Text = 'YEdit' + BorderSpacing.Top = 4 + TabOrder = 7 + TextHint = 'Y Axis Title' end - object SizeEdit: TEdit - AnchorSideLeft.Control = BubbleEdit - AnchorSideRight.Control = Panel1 - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = SizeOutBtn - AnchorSideBottom.Side = asrBottom - Left = 264 - Height = 23 - Top = 262 - Width = 220 - Anchors = [akLeft, akRight, akBottom] - BorderSpacing.Bottom = 12 - ReadOnly = True - TabOrder = 12 - Text = 'SizeEdit' + 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 CloseBtn: TButton - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - 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 + object ParamsSplitter: TSplitter + Left = 388 + Height = 465 + Top = 0 + Width = 5 + ResizeStyle = rsPattern end - object ComputeBtn: TButton - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = CloseBtn - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 349 - Height = 25 - Top = 421 - Width = 76 - Anchors = [akRight, akBottom] - AutoSize = True + 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 - Caption = 'Compute' - OnClick = ComputeBtnClick - TabOrder = 7 - end - object ResetBtn: TButton - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = ComputeBtn - AnchorSideBottom.Control = Owner - 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 + TabIndex = 0 + TabOrder = 2 + object ReportPage: TTabSheet + Caption = 'Report' + end + object ChartPage: TTabSheet + Caption = 'Chart' + end end end diff --git a/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.pas b/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.pas index 361624113..7edca6dc4 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.pas @@ -3,14 +3,13 @@ unit BubblePlotUnit; {$mode objfpc}{$H+} -{$I ../../../LazStats.inc} interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, - StdCtrls, Clipbrd, Buttons, ExtCtrls, Math, - MainUnit, Globals, DataProcs, DictionaryUnit, ContextHelpUnit; + StdCtrls, Clipbrd, Buttons, ExtCtrls, ComCtrls, Math, + MainUnit, Globals, DataProcs, DictionaryUnit, ContextHelpUnit, ChartFrameUnit, ReportFrameUnit; type @@ -20,7 +19,12 @@ type TBubbleForm = class(TForm) Bevel1: TBevel; HelpBtn: TButton; + PageControl: TPageControl; Panel1: TPanel; + ParamsPanel: TPanel; + ParamsSplitter: TSplitter; + ReportPage: TTabSheet; + ChartPage: TTabSheet; TransformChk: TCheckBox; YLabelEdit: TEdit; Label8: TLabel; @@ -59,6 +63,7 @@ type procedure CloseBtnClick(Sender: TObject); procedure SizeInBtnClick(Sender: TObject); procedure SizeOutBtnClick(Sender: TObject); + procedure VarListDblClick(Sender: TObject); procedure VarListSelectionChange(Sender: TObject; {%H-}User: boolean); procedure XInBtnClick(Sender: TObject); procedure XOutBtnClick(Sender: TObject); @@ -68,9 +73,9 @@ type { private declarations } BubbleCol, XCol, YCol, SizeCol: Integer; FAutoSized: boolean; - procedure PlotBubbles( - {$IFNDEF USE_TACHART}NoReplications: Integer; XMax, XMin: Integer;{$ENDIF} - YMax, YMin, BubMax, BubMin: Double); + FReportFrame: TReportFrame; + FChartFrame: TChartFrame; + procedure PlotBubbles(YMax, YMin, BubMax, BubMin: Double); procedure UpdateBtnStates; public { public declarations } @@ -85,13 +90,8 @@ implementation {$R *.lfm} uses - {$IFDEF USE_TACHART} - TAMultiSeries, - ChartUnit, - {$ELSE} - BlankFrmUnit, - {$ENDIF} - OutputUnit; + TAChartUtils, TALegend, TAMultiSeries, + Utils; { TBubbleForm } @@ -255,12 +255,10 @@ begin lReport.Add(' Object %5d Mean: %8.3f', [i+1, CaseSizeMeans[i]]); // Show the report - if DisplayReport(lReport) then - // Plot the bubbles - PlotBubbles( - {$IFNDEF USE_TACHART}NoReplications, XMax, XMin, {$ENDIF} - YMax, YMin, BubMax, BubMin - ); + FReportFrame.DisplayReport(lReport); + + // Plot the bubbles + PlotBubbles(YMax, YMin, BubMax, BubMin); finally lReport.Free; @@ -380,10 +378,17 @@ begin CloseBtn.Constraints.MinWidth := w; 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.MinHeight := Height; + Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 200; + 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; FAutoSized := True; @@ -394,6 +399,17 @@ procedure TBubbleForm.FormCreate(Sender: TObject); begin Assert(OS3MainFrm <> nil); 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; end; @@ -433,7 +449,6 @@ begin end; -{$IFDEF USE_TACHART} procedure TBubbleForm.PlotBubbles(YMax, YMin, BubMax, BubMin: Double); var ser: TBubbleSeries; @@ -447,22 +462,19 @@ begin yRange := YMax - YMin; BubRange := BubMax - BubMin; - if ChartForm = nil then - ChartForm := TChartForm.Create(Application) - else - ChartForm.Clear; + FChartFrame.Clear; // Titles - ChartForm.Caption := 'Bubble Plot of ' + OS3MainFrm.FileNameEdit.Text + LineEnding + TitleEdit.Text; - ChartForm.SetTitle(TitleEdit.Text); + FChartFrame.Caption := 'Bubble Plot of ' + OS3MainFrm.FileNameEdit.Text + LineEnding + TitleEdit.Text; + FChartFrame.SetTitle(TitleEdit.Text); if XLabelEdit.Text <> '' then - ChartForm.SetXTitle(XLabelEdit.Text) + FChartFrame.SetXTitle(XLabelEdit.Text) else - ChartForm.SetXTitle(XEdit.Text); + FChartFrame.SetXTitle(XEdit.Text); if YLabelEdit.Text <> '' then - ChartForm.SetYTitle(YLabelEdit.Text) + FChartFrame.SetYTitle(YLabelEdit.Text) else - ChartForm.SetYTitle(YEdit.Text); + FChartFrame.SetYTitle(YEdit.Text); // Collect bubble IDs and create a bubble series for each unique ID. bubbleIDs := TStringList.Create; @@ -475,12 +487,12 @@ begin end; for i := 0 to bubbleIDs.Count-1 do begin - ser := TBubbleSeries.Create(ChartForm); + ser := TBubbleSeries.Create(FChartFrame.Chart); ser.BubbleBrush.Color := DATA_COLORS[i mod Length(DATA_COLORS)]; ser.BubbleRadiusUnits := bruY; ser.Title := bubbleIDs[i]; ser.Tag := StrToInt(bubbleIDs[i]); - ChartForm.Chart.AddSeries(ser); + FChartFrame.Chart.AddSeries(ser); end; finally bubbleIDs.Free; @@ -489,11 +501,11 @@ begin for i := 1 to NoCases do begin id := StrToInt(OS3MainFrm.DataGrid.Cells[BubbleCol, i]); // Find the series having this ID - for j := 0 to ChartForm.Chart.SeriesCount-1 do - if (ChartForm.Chart.Series[j] is TBubbleSeries) and - (TBubbleSeries(ChartForm.Chart.Series[j]).Tag = id) then + for j := 0 to FChartFrame.Chart.SeriesCount-1 do + if (FChartFrame.Chart.Series[j] is TBubbleSeries) and + (TBubbleSeries(FChartFrame.Chart.Series[j]).Tag = id) then begin - ser := TBubbleSeries(ChartForm.Chart.Series[j]); + ser := TBubbleSeries(FChartFrame.Chart.Series[j]); break; end; @@ -507,113 +519,8 @@ begin ser.AddXY(xValue, yValue, sizeValue); end; - ChartForm.Chart.Legend.Visible := true; - ChartForm.Show; + FChartFrame.Chart.Legend.Visible := true; 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; @@ -668,6 +575,26 @@ begin UpdateBtnStates; 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; var diff --git a/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.pas b/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.pas index af6f5ad1e..04def57c8 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.pas @@ -403,7 +403,6 @@ begin Marks.Style := smsLabel; Grid.Visible := false; end; - InitToolbar(FChartFrame.ChartToolbar, tpTop); Reset; end; diff --git a/applications/lazstats/source/frames/chartframeunit.pas b/applications/lazstats/source/frames/chartframeunit.pas index d1b46a4f5..c8cb815bf 100644 --- a/applications/lazstats/source/frames/chartframeunit.pas +++ b/applications/lazstats/source/frames/chartframeunit.pas @@ -62,7 +62,8 @@ implementation uses Math, Printers, OSPrinters, - TAChartUtils, TADrawerSVG, TAPrint; + TAChartUtils, TADrawerSVG, TAPrint, + Utils; constructor TChartFrame.Create(AOwner: TComponent); @@ -72,6 +73,7 @@ begin ZoomDragTool.LimitToExtent := [zdDown]; PanDragTool.LimitToExtent := [pdDown]; {$IFEND} + InitToolbar(ChartToolbar, tpTop); UpdateBtnStates; end;