You've already forked lazarus-ccr
LazStats: Inherit form of XvsMultYUnit from TBasicStatsReportAndChartForm.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7742 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
object XvsMultYForm: TXvsMultYForm
|
inherited XvsMultYForm: TXvsMultYForm
|
||||||
Left = 288
|
Left = 288
|
||||||
Height = 500
|
Height = 500
|
||||||
Top = 117
|
Top = 117
|
||||||
@ -8,26 +8,33 @@ object XvsMultYForm: TXvsMultYForm
|
|||||||
Caption = 'X vs Multiple Y Plot'
|
Caption = 'X vs Multiple Y Plot'
|
||||||
ClientHeight = 500
|
ClientHeight = 500
|
||||||
ClientWidth = 1000
|
ClientWidth = 1000
|
||||||
OnActivate = FormActivate
|
inherited ParamsPanel: TPanel
|
||||||
OnCreate = FormCreate
|
|
||||||
OnShow = ResetBtnClick
|
|
||||||
Position = poMainFormCenter
|
|
||||||
LCLVersion = '2.1.0.0'
|
|
||||||
object ParamsPanel: TPanel
|
|
||||||
Left = 8
|
|
||||||
Height = 484
|
Height = 484
|
||||||
Top = 8
|
|
||||||
Width = 296
|
Width = 296
|
||||||
Align = alLeft
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 4
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
BevelOuter = bvNone
|
|
||||||
ClientHeight = 484
|
ClientHeight = 484
|
||||||
ClientWidth = 296
|
ClientWidth = 296
|
||||||
TabOrder = 0
|
inherited CloseBtn: TButton
|
||||||
object Panel1: TPanel
|
Left = 241
|
||||||
|
Top = 459
|
||||||
|
TabOrder = 4
|
||||||
|
end
|
||||||
|
inherited ComputeBtn: TButton
|
||||||
|
Left = 158
|
||||||
|
Top = 459
|
||||||
|
end
|
||||||
|
inherited ResetBtn: TButton
|
||||||
|
Left = 96
|
||||||
|
Top = 459
|
||||||
|
end
|
||||||
|
inherited HelpBtn: TButton
|
||||||
|
Left = 37
|
||||||
|
Top = 459
|
||||||
|
end
|
||||||
|
inherited ButtonBevel: TBevel
|
||||||
|
Top = 443
|
||||||
|
Width = 296
|
||||||
|
end
|
||||||
|
object Panel1: TPanel[5]
|
||||||
AnchorSideLeft.Control = ParamsPanel
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideTop.Control = ParamsPanel
|
AnchorSideTop.Control = ParamsPanel
|
||||||
AnchorSideRight.Control = ParamsPanel
|
AnchorSideRight.Control = ParamsPanel
|
||||||
@ -197,90 +204,8 @@ object XvsMultYForm: TXvsMultYForm
|
|||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object CloseBtn: TButton
|
object GroupBox1: TGroupBox[6]
|
||||||
AnchorSideRight.Control = ParamsPanel
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = ParamsPanel
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 241
|
|
||||||
Height = 25
|
|
||||||
Top = 459
|
|
||||||
Width = 55
|
|
||||||
Anchors = [akRight, akBottom]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
Caption = 'Close'
|
|
||||||
ModalResult = 11
|
|
||||||
OnClick = CloseBtnClick
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
object ComputeBtn: TButton
|
|
||||||
AnchorSideRight.Control = CloseBtn
|
|
||||||
AnchorSideBottom.Control = ParamsPanel
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 157
|
|
||||||
Height = 25
|
|
||||||
Top = 459
|
|
||||||
Width = 76
|
|
||||||
Anchors = [akRight, akBottom]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
Caption = 'Compute'
|
|
||||||
OnClick = ComputeBtnClick
|
|
||||||
TabOrder = 2
|
|
||||||
end
|
|
||||||
object ResetBtn: TButton
|
|
||||||
AnchorSideRight.Control = ComputeBtn
|
|
||||||
AnchorSideBottom.Control = ParamsPanel
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 95
|
|
||||||
Height = 25
|
|
||||||
Top = 459
|
|
||||||
Width = 54
|
|
||||||
Anchors = [akRight, akBottom]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
Caption = 'Reset'
|
|
||||||
OnClick = ResetBtnClick
|
|
||||||
TabOrder = 3
|
|
||||||
end
|
|
||||||
object Bevel2: TBevel
|
|
||||||
AnchorSideLeft.Control = ParamsPanel
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideRight.Control = ParamsPanel
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = CloseBtn
|
|
||||||
Left = 0
|
|
||||||
Height = 8
|
|
||||||
Top = 443
|
|
||||||
Width = 296
|
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
|
||||||
Shape = bsBottomLine
|
|
||||||
end
|
|
||||||
object HelpBtn: TButton
|
|
||||||
Tag = 161
|
|
||||||
AnchorSideRight.Control = ResetBtn
|
|
||||||
AnchorSideBottom.Control = ParamsPanel
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 36
|
|
||||||
Height = 25
|
|
||||||
Top = 459
|
|
||||||
Width = 51
|
|
||||||
Anchors = [akRight, akBottom]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
Caption = 'Help'
|
|
||||||
OnClick = HelpBtnClick
|
|
||||||
TabOrder = 4
|
|
||||||
end
|
|
||||||
object GroupBox1: TGroupBox
|
|
||||||
AnchorSideLeft.Control = ParamsPanel
|
|
||||||
AnchorSideBottom.Control = Bevel2
|
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 51
|
Height = 51
|
||||||
Top = 384
|
Top = 384
|
||||||
@ -317,7 +242,7 @@ object XvsMultYForm: TXvsMultYForm
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object Label4: TLabel
|
object Label4: TLabel[7]
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = PlotTitleEdit
|
AnchorSideTop.Control = PlotTitleEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
@ -328,7 +253,7 @@ object XvsMultYForm: TXvsMultYForm
|
|||||||
Caption = 'Plot Title:'
|
Caption = 'Plot Title:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object PlotTitleEdit: TEdit
|
object PlotTitleEdit: TEdit[8]
|
||||||
AnchorSideLeft.Control = Label4
|
AnchorSideLeft.Control = Label4
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideRight.Control = ParamsPanel
|
AnchorSideRight.Control = ParamsPanel
|
||||||
@ -344,28 +269,13 @@ object XvsMultYForm: TXvsMultYForm
|
|||||||
TextHint = 'Title above the chart'
|
TextHint = 'Title above the chart'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object ParamsSplitter: TSplitter
|
inherited ParamsSplitter: TSplitter
|
||||||
Left = 308
|
Left = 308
|
||||||
Height = 500
|
Height = 500
|
||||||
Top = 0
|
|
||||||
Width = 5
|
|
||||||
ResizeStyle = rsPattern
|
|
||||||
end
|
end
|
||||||
object PageControl1: TPageControl
|
inherited PageControl: TPageControl
|
||||||
Left = 317
|
Left = 317
|
||||||
Height = 484
|
Height = 484
|
||||||
Top = 8
|
|
||||||
Width = 675
|
Width = 675
|
||||||
ActivePage = ChartPage
|
|
||||||
Align = alClient
|
|
||||||
BorderSpacing.Left = 4
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
TabIndex = 0
|
|
||||||
TabOrder = 2
|
|
||||||
object ChartPage: TTabSheet
|
|
||||||
Caption = 'Chart'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,29 +9,19 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||||
StdCtrls, Buttons, ExtCtrls, Printers, ComCtrls,
|
StdCtrls, Buttons, ExtCtrls, Printers, ComCtrls,
|
||||||
MainUnit, Globals, ContextHelpUnit, DataProcs, MatrixLib, BasicStatsFormUnit,
|
MainUnit, Globals, ContextHelpUnit, DataProcs, MatrixLib, BasicStatsReportAndChartFormUnit,
|
||||||
ReportFrameUnit, ChartFrameUnit;
|
ReportFrameUnit, ChartFrameUnit;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TXvsMultYForm }
|
{ TXvsMultYForm }
|
||||||
|
|
||||||
TXvsMultYForm = class(TBasicStatsForm)
|
TXvsMultYForm = class(TBasicStatsReportAndChartForm)
|
||||||
Bevel2: TBevel;
|
|
||||||
LinesBox: TCheckBox;
|
LinesBox: TCheckBox;
|
||||||
GroupBox1: TGroupBox;
|
GroupBox1: TGroupBox;
|
||||||
PageControl1: TPageControl;
|
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
ParamsPanel: TPanel;
|
|
||||||
ResetBtn: TButton;
|
|
||||||
ComputeBtn: TButton;
|
|
||||||
CloseBtn: TButton;
|
|
||||||
PlotTitleEdit: TEdit;
|
PlotTitleEdit: TEdit;
|
||||||
Label4: TLabel;
|
Label4: TLabel;
|
||||||
HelpBtn: TButton;
|
|
||||||
ParamsSplitter: TSplitter;
|
|
||||||
ReportPage: TTabSheet;
|
|
||||||
ChartPage: TTabSheet;
|
|
||||||
YBox: TListBox;
|
YBox: TListBox;
|
||||||
XEdit: TEdit;
|
XEdit: TEdit;
|
||||||
Label2: TLabel;
|
Label2: TLabel;
|
||||||
@ -42,12 +32,6 @@ type
|
|||||||
XOutBtn: TBitBtn;
|
XOutBtn: TBitBtn;
|
||||||
YOutBtn: TBitBtn;
|
YOutBtn: TBitBtn;
|
||||||
VarList: TListBox;
|
VarList: TListBox;
|
||||||
procedure CloseBtnClick(Sender: TObject);
|
|
||||||
procedure ComputeBtnClick(Sender: TObject);
|
|
||||||
procedure FormActivate(Sender: TObject);
|
|
||||||
procedure FormCreate(Sender: TObject);
|
|
||||||
procedure HelpBtnClick(Sender: TObject);
|
|
||||||
procedure ResetBtnClick(Sender: TObject);
|
|
||||||
procedure VarListDblClick(Sender: TObject);
|
procedure VarListDblClick(Sender: TObject);
|
||||||
procedure VarListSelectionChange(Sender: TObject; User: boolean);
|
procedure VarListSelectionChange(Sender: TObject; User: boolean);
|
||||||
procedure XInBtnClick(Sender: TObject);
|
procedure XInBtnClick(Sender: TObject);
|
||||||
@ -56,12 +40,12 @@ type
|
|||||||
procedure YOutBtnClick(Sender: TObject);
|
procedure YOutBtnClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
FReportFrame: TReportFrame;
|
|
||||||
FChartFrame: TChartFrame;
|
|
||||||
FAutoSized: Boolean;
|
|
||||||
selected: IntDyneVec;
|
selected: IntDyneVec;
|
||||||
procedure PlotXY(XValues: DblDyneVec; YValues: DblDyneMat);
|
procedure PlotXY(XValues: DblDyneVec; YValues: DblDyneMat);
|
||||||
procedure UpdateBtnStates;
|
protected
|
||||||
|
procedure AdjustConstraints; override;
|
||||||
|
procedure Compute; override;
|
||||||
|
procedure UpdateBtnStates; override;
|
||||||
public
|
public
|
||||||
{ public declarations }
|
{ public declarations }
|
||||||
procedure Reset; override;
|
procedure Reset; override;
|
||||||
@ -82,13 +66,7 @@ uses
|
|||||||
|
|
||||||
{ TXvsMultYForm }
|
{ TXvsMultYForm }
|
||||||
|
|
||||||
procedure TXvsMultYForm.CloseBtnClick(Sender: TObject);
|
procedure TXvsMultYForm.Compute;
|
||||||
begin
|
|
||||||
Close;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure TXvsMultYForm.ComputeBtnClick(Sender: TObject);
|
|
||||||
var
|
var
|
||||||
i, j, N, NoY, XCol, NoSelected: integer;
|
i, j, N, NoY, XCol, NoSelected: integer;
|
||||||
MinX, MaxX, MinY, MaxY: double;
|
MinX, MaxX, MinY, MaxY: double;
|
||||||
@ -230,60 +208,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TXvsMultYForm.FormActivate(Sender: TObject);
|
procedure TXvsMultYForm.AdjustConstraints;
|
||||||
var
|
|
||||||
w: Integer;
|
|
||||||
begin
|
begin
|
||||||
if FAutoSized then
|
|
||||||
exit;
|
|
||||||
|
|
||||||
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
|
|
||||||
HelpBtn.Constraints.MinWidth := w;
|
|
||||||
ResetBtn.Constraints.MinWidth := w;
|
|
||||||
ComputeBtn.Constraints.MinWidth := w;
|
|
||||||
CloseBtn.Constraints.MinWidth := w;
|
|
||||||
|
|
||||||
Panel1.Constraints.MinHeight := YOutBtn.Top + YOutBtn.Height;
|
Panel1.Constraints.MinHeight := YOutBtn.Top + YOutBtn.Height;
|
||||||
ParamsPanel.Constraints.MinWidth := 4*w + 3*CloseBtn.BorderSpacing.Left;
|
ParamsPanel.Constraints.MinWidth := 4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left;
|
||||||
ParamsPanel.Constraints.MinHeight := Panel1.Constraints.MinHeight + Panel1.BorderSpacing.Bottom +
|
ParamsPanel.Constraints.MinHeight := Panel1.Constraints.MinHeight + Panel1.BorderSpacing.Bottom +
|
||||||
PlotTitleEdit.Height + GroupBox1.Height + 2*GroupBox1.BorderSpacing.Top +
|
PlotTitleEdit.Height + GroupBox1.Height + 2*GroupBox1.BorderSpacing.Top +
|
||||||
Bevel2.Height + CloseBtn.Height + CloseBtn.BorderSpacing.Top;
|
ButtonBevel.Height + CloseBtn.Height + CloseBtn.BorderSpacing.Top;
|
||||||
|
|
||||||
Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + 2*ParamsPanel.BorderSpacing.Top;
|
Constraints.MinHeight := ParamsPanel.Constraints.MinHeight + 2*ParamsPanel.BorderSpacing.Top;
|
||||||
Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 200;
|
Constraints.MinWidth := ParamsPanel.Constraints.MinWidth + 200;
|
||||||
if Height < Constraints.MinHeight then Height := 1; // enforce autosizing if needed
|
|
||||||
if Width < Constraints.MinWidth then Width :=1;
|
|
||||||
|
|
||||||
Position := poDesigned;
|
|
||||||
FAutoSized := true;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure TXvsMultYForm.FormCreate(Sender: TObject);
|
|
||||||
begin
|
|
||||||
Assert(OS3MainFrm <> nil);
|
|
||||||
|
|
||||||
InitForm(self);
|
|
||||||
|
|
||||||
FReportFrame := TReportFrame.Create(self);
|
|
||||||
FReportFrame.Parent := ReportPage;
|
|
||||||
FReportFrame.Align := alClient;
|
|
||||||
|
|
||||||
FChartFrame := TChartFrame.Create(self);
|
|
||||||
FChartFrame.Parent := ChartPage;
|
|
||||||
FChartFrame.Align := alClient;
|
|
||||||
FChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80;
|
|
||||||
FChartFrame.Chart.BottomAxis.Intervals.MinLength := 30;
|
|
||||||
|
|
||||||
Reset;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure TXvsMultYForm.HelpBtnClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
if ContextHelpForm = nil then
|
|
||||||
Application.CreateForm(TContextHelpForm, ContextHelpForm);
|
|
||||||
ContextHelpForm.HelpMessage((Sender as TButton).Tag);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -330,14 +264,13 @@ begin
|
|||||||
PlotTitleEdit.Text := '';
|
PlotTitleEdit.Text := '';
|
||||||
for i := 1 to NoVariables do
|
for i := 1 to NoVariables do
|
||||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||||
|
if Assigned(FReportFrame) then
|
||||||
|
FReportFrame.Clear;
|
||||||
|
if Assigned(FChartFrame) then
|
||||||
|
FChartFrame.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TXvsMultYForm.ResetBtnClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
Reset;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TXvsMultYForm.UpdateBtnStates;
|
procedure TXvsMultYForm.UpdateBtnStates;
|
||||||
var
|
var
|
||||||
lSelected: Boolean;
|
lSelected: Boolean;
|
||||||
@ -348,8 +281,8 @@ begin
|
|||||||
xOutBtn.Enabled := (XEdit.Text <> '');
|
xOutBtn.Enabled := (XEdit.Text <> '');
|
||||||
YOutBtn.Enabled := AnySelected(YBox);
|
YOutBtn.Enabled := AnySelected(YBox);
|
||||||
|
|
||||||
FReportFrame.UpdateBtnStates;
|
if Assigned(FReportFrame) then FReportFrame.UpdateBtnStates;
|
||||||
FChartFrame.UpdateBtnStates;
|
if Assigned(FChartFrame) then FChartFrame.UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +114,8 @@ VAR
|
|||||||
ColNoSelected: IntDyneVec;
|
ColNoSelected: IntDyneVec;
|
||||||
dblvalue: double;
|
dblvalue: double;
|
||||||
DataGrid: DblDyneMat;
|
DataGrid: DblDyneMat;
|
||||||
RowLabels, ColLabels: StrDyneVec;
|
RowLabels: StrDyneVec = nil;
|
||||||
|
ColLabels: StrDyneVec = nil;
|
||||||
errorcode: boolean;
|
errorcode: boolean;
|
||||||
lReport: TStrings;
|
lReport: TStrings;
|
||||||
begin
|
begin
|
||||||
|
Reference in New Issue
Block a user