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
|
||||
Height = 500
|
||||
Top = 117
|
||||
@ -8,26 +8,33 @@ object XvsMultYForm: TXvsMultYForm
|
||||
Caption = 'X vs Multiple Y Plot'
|
||||
ClientHeight = 500
|
||||
ClientWidth = 1000
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
OnShow = ResetBtnClick
|
||||
Position = poMainFormCenter
|
||||
LCLVersion = '2.1.0.0'
|
||||
object ParamsPanel: TPanel
|
||||
Left = 8
|
||||
inherited ParamsPanel: TPanel
|
||||
Height = 484
|
||||
Top = 8
|
||||
Width = 296
|
||||
Align = alLeft
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 8
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 484
|
||||
ClientWidth = 296
|
||||
TabOrder = 0
|
||||
object Panel1: TPanel
|
||||
inherited CloseBtn: TButton
|
||||
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
|
||||
AnchorSideTop.Control = ParamsPanel
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
@ -197,90 +204,8 @@ object XvsMultYForm: TXvsMultYForm
|
||||
TabOrder = 6
|
||||
end
|
||||
end
|
||||
object CloseBtn: TButton
|
||||
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
|
||||
object GroupBox1: TGroupBox[6]
|
||||
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
|
||||
Height = 51
|
||||
Top = 384
|
||||
@ -317,7 +242,7 @@ object XvsMultYForm: TXvsMultYForm
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object Label4: TLabel
|
||||
object Label4: TLabel[7]
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = PlotTitleEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
@ -328,7 +253,7 @@ object XvsMultYForm: TXvsMultYForm
|
||||
Caption = 'Plot Title:'
|
||||
ParentColor = False
|
||||
end
|
||||
object PlotTitleEdit: TEdit
|
||||
object PlotTitleEdit: TEdit[8]
|
||||
AnchorSideLeft.Control = Label4
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideRight.Control = ParamsPanel
|
||||
@ -344,28 +269,13 @@ object XvsMultYForm: TXvsMultYForm
|
||||
TextHint = 'Title above the chart'
|
||||
end
|
||||
end
|
||||
object ParamsSplitter: TSplitter
|
||||
inherited ParamsSplitter: TSplitter
|
||||
Left = 308
|
||||
Height = 500
|
||||
Top = 0
|
||||
Width = 5
|
||||
ResizeStyle = rsPattern
|
||||
end
|
||||
object PageControl1: TPageControl
|
||||
inherited PageControl: TPageControl
|
||||
Left = 317
|
||||
Height = 484
|
||||
Top = 8
|
||||
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
|
||||
|
@ -9,29 +9,19 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Buttons, ExtCtrls, Printers, ComCtrls,
|
||||
MainUnit, Globals, ContextHelpUnit, DataProcs, MatrixLib, BasicStatsFormUnit,
|
||||
MainUnit, Globals, ContextHelpUnit, DataProcs, MatrixLib, BasicStatsReportAndChartFormUnit,
|
||||
ReportFrameUnit, ChartFrameUnit;
|
||||
|
||||
type
|
||||
|
||||
{ TXvsMultYForm }
|
||||
|
||||
TXvsMultYForm = class(TBasicStatsForm)
|
||||
Bevel2: TBevel;
|
||||
TXvsMultYForm = class(TBasicStatsReportAndChartForm)
|
||||
LinesBox: TCheckBox;
|
||||
GroupBox1: TGroupBox;
|
||||
PageControl1: TPageControl;
|
||||
Panel1: TPanel;
|
||||
ParamsPanel: TPanel;
|
||||
ResetBtn: TButton;
|
||||
ComputeBtn: TButton;
|
||||
CloseBtn: TButton;
|
||||
PlotTitleEdit: TEdit;
|
||||
Label4: TLabel;
|
||||
HelpBtn: TButton;
|
||||
ParamsSplitter: TSplitter;
|
||||
ReportPage: TTabSheet;
|
||||
ChartPage: TTabSheet;
|
||||
YBox: TListBox;
|
||||
XEdit: TEdit;
|
||||
Label2: TLabel;
|
||||
@ -42,12 +32,6 @@ type
|
||||
XOutBtn: TBitBtn;
|
||||
YOutBtn: TBitBtn;
|
||||
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 VarListSelectionChange(Sender: TObject; User: boolean);
|
||||
procedure XInBtnClick(Sender: TObject);
|
||||
@ -56,12 +40,12 @@ type
|
||||
procedure YOutBtnClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
FReportFrame: TReportFrame;
|
||||
FChartFrame: TChartFrame;
|
||||
FAutoSized: Boolean;
|
||||
selected: IntDyneVec;
|
||||
procedure PlotXY(XValues: DblDyneVec; YValues: DblDyneMat);
|
||||
procedure UpdateBtnStates;
|
||||
protected
|
||||
procedure AdjustConstraints; override;
|
||||
procedure Compute; override;
|
||||
procedure UpdateBtnStates; override;
|
||||
public
|
||||
{ public declarations }
|
||||
procedure Reset; override;
|
||||
@ -82,13 +66,7 @@ uses
|
||||
|
||||
{ TXvsMultYForm }
|
||||
|
||||
procedure TXvsMultYForm.CloseBtnClick(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
|
||||
procedure TXvsMultYForm.ComputeBtnClick(Sender: TObject);
|
||||
procedure TXvsMultYForm.Compute;
|
||||
var
|
||||
i, j, N, NoY, XCol, NoSelected: integer;
|
||||
MinX, MaxX, MinY, MaxY: double;
|
||||
@ -230,60 +208,16 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TXvsMultYForm.FormActivate(Sender: TObject);
|
||||
var
|
||||
w: Integer;
|
||||
procedure TXvsMultYForm.AdjustConstraints;
|
||||
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;
|
||||
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 +
|
||||
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.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;
|
||||
|
||||
|
||||
@ -330,14 +264,13 @@ begin
|
||||
PlotTitleEdit.Text := '';
|
||||
for i := 1 to NoVariables do
|
||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
||||
if Assigned(FReportFrame) then
|
||||
FReportFrame.Clear;
|
||||
if Assigned(FChartFrame) then
|
||||
FChartFrame.Clear;
|
||||
end;
|
||||
|
||||
|
||||
procedure TXvsMultYForm.ResetBtnClick(Sender: TObject);
|
||||
begin
|
||||
Reset;
|
||||
end;
|
||||
|
||||
procedure TXvsMultYForm.UpdateBtnStates;
|
||||
var
|
||||
lSelected: Boolean;
|
||||
@ -348,8 +281,8 @@ begin
|
||||
xOutBtn.Enabled := (XEdit.Text <> '');
|
||||
YOutBtn.Enabled := AnySelected(YBox);
|
||||
|
||||
FReportFrame.UpdateBtnStates;
|
||||
FChartFrame.UpdateBtnStates;
|
||||
if Assigned(FReportFrame) then FReportFrame.UpdateBtnStates;
|
||||
if Assigned(FChartFrame) then FChartFrame.UpdateBtnStates;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -114,7 +114,8 @@ VAR
|
||||
ColNoSelected: IntDyneVec;
|
||||
dblvalue: double;
|
||||
DataGrid: DblDyneMat;
|
||||
RowLabels, ColLabels: StrDyneVec;
|
||||
RowLabels: StrDyneVec = nil;
|
||||
ColLabels: StrDyneVec = nil;
|
||||
errorcode: boolean;
|
||||
lReport: TStrings;
|
||||
begin
|
||||
|
Reference in New Issue
Block a user