You've already forked lazarus-ccr
LazStats: Use TAChart and SPC form tempate in PChartUnit.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7656 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -49,7 +49,7 @@
|
|||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item7>
|
</Item7>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="175">
|
<Units Count="176">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="LazStats.lpr"/>
|
<Filename Value="LazStats.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -752,12 +752,11 @@
|
|||||||
<UnitName Value="CUMSUMUnit"/>
|
<UnitName Value="CUMSUMUnit"/>
|
||||||
</Unit89>
|
</Unit89>
|
||||||
<Unit90>
|
<Unit90>
|
||||||
<Filename Value="forms\analysis\statistical_process_control\pchartunit.pas"/>
|
<Filename Value="forms\analysis\statistical_process_control\pchartunit1.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="pChartFrm"/>
|
<ComponentName Value="pChartFrm"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="PChartUnit"/>
|
|
||||||
</Unit90>
|
</Unit90>
|
||||||
<Unit91>
|
<Unit91>
|
||||||
<Filename Value="forms\analysis\statistical_process_control\uchartunit.pas"/>
|
<Filename Value="forms\analysis\statistical_process_control\uchartunit.pas"/>
|
||||||
@ -1421,6 +1420,14 @@
|
|||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="CChartUnit"/>
|
<UnitName Value="CChartUnit"/>
|
||||||
</Unit174>
|
</Unit174>
|
||||||
|
<Unit175>
|
||||||
|
<Filename Value="forms\analysis\statistical_process_control\pchartunit.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="PChartForm"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<UnitName Value="PChartUnit"/>
|
||||||
|
</Unit175>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -9,7 +9,8 @@ uses
|
|||||||
Interfaces, // this includes the LCL widgetset
|
Interfaces, // this includes the LCL widgetset
|
||||||
Forms, tachartlazaruspkg, tachartprint, lhelpcontrolpkg, Globals, LicenseUnit,
|
Forms, tachartlazaruspkg, tachartprint, lhelpcontrolpkg, Globals, LicenseUnit,
|
||||||
OptionsUnit, MainDM, MainUnit, MathUnit, BasicSPCUnit,
|
OptionsUnit, MainDM, MainUnit, MathUnit, BasicSPCUnit,
|
||||||
SChartUnit, rchartunit, XBarChartUnit, cchartunit; //, utils, chartunit;
|
SChartUnit, rchartunit, XBarChartUnit, cchartunit,
|
||||||
|
pchartunit; //, utils, chartunit;
|
||||||
|
|
||||||
{$R LazStats.res}
|
{$R LazStats.res}
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ begin
|
|||||||
Application.CreateForm(TRChartForm, RChartForm);
|
Application.CreateForm(TRChartForm, RChartForm);
|
||||||
Application.CreateForm(TXBarChartForm, XBarChartForm);
|
Application.CreateForm(TXBarChartForm, XBarChartForm);
|
||||||
Application.CreateForm(TCChartForm, CChartForm);
|
Application.CreateForm(TCChartForm, CChartForm);
|
||||||
|
Application.CreateForm(TPChartForm, PChartForm);
|
||||||
Application.Run;
|
Application.Run;
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ var
|
|||||||
numData: Integer;
|
numData: Integer;
|
||||||
lReport: TStrings;
|
lReport: TStrings;
|
||||||
begin
|
begin
|
||||||
SetLength(ColNoSelected,1);
|
SetLength(ColNoSelected, 1);
|
||||||
ColNoSelected[0] := MeasVar;
|
ColNoSelected[0] := MeasVar;
|
||||||
|
|
||||||
case SigmaOptns.ItemIndex of
|
case SigmaOptns.ItemIndex of
|
||||||
@ -105,8 +105,6 @@ begin
|
|||||||
UCL, LCL, meanc,
|
UCL, LCL, meanc,
|
||||||
NaN, NaN, NaN
|
NaN, NaN, NaN
|
||||||
);
|
);
|
||||||
|
|
||||||
//PlotMeans(means, NoCases, UCL, LCL, meanc);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCChartForm.FormActivate(Sender: TObject);
|
procedure TCChartForm.FormActivate(Sender: TObject);
|
||||||
|
@ -1,289 +1,174 @@
|
|||||||
object pChartFrm: TpChartFrm
|
inherited PChartForm: TPChartForm
|
||||||
Left = 504
|
Left = 556
|
||||||
Height = 371
|
Top = 220
|
||||||
Top = 382
|
|
||||||
Width = 511
|
|
||||||
HelpType = htKeyword
|
HelpType = htKeyword
|
||||||
HelpKeyword = 'html/PControlChart.htm'
|
HelpKeyword = 'html/PControlChart.htm'
|
||||||
AutoSize = True
|
Caption = 'P Control Chart'
|
||||||
Caption = 'p Control Chart'
|
|
||||||
ClientHeight = 371
|
|
||||||
ClientWidth = 511
|
|
||||||
OnActivate = FormActivate
|
OnActivate = FormActivate
|
||||||
OnCreate = FormCreate
|
inherited SpecsPanel: TPanel
|
||||||
OnShow = FormShow
|
Width = 456
|
||||||
LCLVersion = '2.1.0.0'
|
ClientWidth = 456
|
||||||
object Label1: TLabel
|
inherited ButtonPanel: TPanel
|
||||||
AnchorSideLeft.Control = Owner
|
Width = 456
|
||||||
AnchorSideTop.Control = Owner
|
ClientWidth = 456
|
||||||
Left = 8
|
inherited CloseBtn: TButton
|
||||||
Height = 15
|
Left = 401
|
||||||
Top = 8
|
end
|
||||||
Width = 97
|
inherited ComputeBtn: TButton
|
||||||
BorderSpacing.Left = 8
|
Left = 317
|
||||||
BorderSpacing.Top = 8
|
end
|
||||||
Caption = 'Selection Variables'
|
inherited ResetBtn: TButton
|
||||||
ParentColor = False
|
Left = 255
|
||||||
end
|
end
|
||||||
object Label2: TLabel
|
inherited HelpBtn: TButton
|
||||||
AnchorSideLeft.Control = MeasEdit
|
Left = 204
|
||||||
AnchorSideTop.Control = Owner
|
end
|
||||||
Left = 264
|
inherited Bevel1: TBevel
|
||||||
Height = 15
|
Width = 448
|
||||||
Top = 8
|
end
|
||||||
Width = 117
|
end
|
||||||
BorderSpacing.Top = 8
|
inherited VarList: TListBox
|
||||||
Caption = 'Measurement Variable'
|
Width = 224
|
||||||
ParentColor = False
|
end
|
||||||
end
|
inherited GroupLabel: TLabel
|
||||||
object Label3: TLabel
|
Left = 240
|
||||||
AnchorSideLeft.Control = Label4
|
Visible = False
|
||||||
AnchorSideTop.Control = NEdit
|
end
|
||||||
AnchorSideTop.Side = asrCenter
|
inherited GroupEdit: TEdit
|
||||||
AnchorSideRight.Control = NEdit
|
Left = 240
|
||||||
Left = 264
|
Width = 216
|
||||||
Height = 15
|
Visible = False
|
||||||
Top = 76
|
end
|
||||||
Width = 167
|
inherited MeasLabel: TLabel
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Left = 240
|
||||||
BorderSpacing.Right = 8
|
end
|
||||||
Caption = 'No. of Parts Sampled:'
|
inherited MeasEdit: TEdit
|
||||||
ParentColor = False
|
Left = 240
|
||||||
end
|
Width = 216
|
||||||
object Label4: TLabel
|
end
|
||||||
AnchorSideTop.Control = PEdit
|
inherited Bevel2: TBevel
|
||||||
AnchorSideTop.Side = asrCenter
|
Left = 217
|
||||||
AnchorSideRight.Control = PEdit
|
end
|
||||||
Left = 264
|
object Label3: TLabel[8]
|
||||||
Height = 15
|
AnchorSideLeft.Control = Label4
|
||||||
Top = 107
|
AnchorSideTop.Control = NEdit
|
||||||
Width = 167
|
AnchorSideTop.Side = asrCenter
|
||||||
Anchors = [akTop, akRight]
|
AnchorSideRight.Control = NEdit
|
||||||
BorderSpacing.Right = 8
|
Left = 270
|
||||||
Caption = 'Expected Proportion of Defects:'
|
Height = 15
|
||||||
ParentColor = False
|
Top = 124
|
||||||
end
|
Width = 114
|
||||||
object VarList: TListBox
|
Anchors = [akTop, akRight]
|
||||||
AnchorSideLeft.Control = Owner
|
BorderSpacing.Right = 8
|
||||||
AnchorSideTop.Control = Label1
|
Caption = 'No. of Parts Sampled:'
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = SigmaOpts
|
|
||||||
AnchorSideBottom.Control = Bevel2
|
|
||||||
Left = 8
|
|
||||||
Height = 297
|
|
||||||
Top = 25
|
|
||||||
Width = 248
|
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 2
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
ItemHeight = 0
|
|
||||||
OnClick = VarListClick
|
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object MeasEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = Label4
|
|
||||||
AnchorSideTop.Control = Label2
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 264
|
|
||||||
Height = 23
|
|
||||||
Top = 25
|
|
||||||
Width = 239
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 2
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
ReadOnly = True
|
|
||||||
TabOrder = 1
|
|
||||||
Text = 'MeasEdit'
|
|
||||||
end
|
|
||||||
object NEdit: TEdit
|
|
||||||
AnchorSideTop.Control = MeasEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 439
|
|
||||||
Height = 23
|
|
||||||
Top = 72
|
|
||||||
Width = 64
|
|
||||||
Alignment = taRightJustify
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
BorderSpacing.Top = 24
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
TabOrder = 2
|
|
||||||
Text = 'NEdit'
|
|
||||||
end
|
|
||||||
object PEdit: TEdit
|
|
||||||
AnchorSideTop.Control = NEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 439
|
|
||||||
Height = 23
|
|
||||||
Top = 103
|
|
||||||
Width = 64
|
|
||||||
Alignment = taRightJustify
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
TabOrder = 3
|
|
||||||
Text = 'Edit1'
|
|
||||||
end
|
|
||||||
object SigmaOpts: TRadioGroup
|
|
||||||
AnchorSideLeft.Control = Label4
|
|
||||||
AnchorSideTop.Control = PEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 264
|
|
||||||
Height = 118
|
|
||||||
Top = 150
|
|
||||||
Width = 239
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
AutoFill = True
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Top = 24
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
Caption = 'No. Of Sigma Units for UCL and LCL'
|
|
||||||
ChildSizing.LeftRightSpacing = 12
|
|
||||||
ChildSizing.TopBottomSpacing = 6
|
|
||||||
ChildSizing.VerticalSpacing = 2
|
|
||||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
|
||||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
|
||||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
|
||||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
|
||||||
ChildSizing.Layout = cclTopToBottomThenLeftToRight
|
|
||||||
ChildSizing.ControlsPerLine = 4
|
|
||||||
ClientHeight = 98
|
|
||||||
ClientWidth = 235
|
|
||||||
ItemIndex = 0
|
|
||||||
Items.Strings = (
|
|
||||||
'3 Sigma (Default)'
|
|
||||||
'2 Sigma'
|
|
||||||
'1 Sigma'
|
|
||||||
'X Sigma where X = '
|
|
||||||
)
|
|
||||||
TabOrder = 4
|
|
||||||
object Label5: TLabel
|
|
||||||
Left = 143
|
|
||||||
Height = 19
|
|
||||||
Top = 6
|
|
||||||
Width = 80
|
|
||||||
Caption = ' '
|
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label6: TLabel
|
object NEdit: TEdit[9]
|
||||||
Left = 143
|
AnchorSideTop.Control = MeasEdit
|
||||||
Height = 19
|
AnchorSideTop.Side = asrBottom
|
||||||
Top = 27
|
AnchorSideRight.Control = MeasEdit
|
||||||
Width = 80
|
|
||||||
Caption = ' '
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object Label7: TLabel
|
|
||||||
Left = 143
|
|
||||||
Height = 19
|
|
||||||
Top = 48
|
|
||||||
Width = 80
|
|
||||||
Caption = ' '
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object XSigmaEdit: TEdit
|
|
||||||
Left = 143
|
|
||||||
Height = 23
|
|
||||||
Top = 69
|
|
||||||
Width = 80
|
|
||||||
Alignment = taRightJustify
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
TabOrder = 2
|
|
||||||
Text = 'XSigmaEdit'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
object Bevel2: TBevel
|
|
||||||
AnchorSideTop.Control = Panel1
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = Panel1
|
|
||||||
Left = 0
|
|
||||||
Height = 8
|
|
||||||
Top = 322
|
|
||||||
Width = 511
|
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
|
||||||
Shape = bsBottomLine
|
|
||||||
end
|
|
||||||
object Panel1: TPanel
|
|
||||||
Left = 8
|
|
||||||
Height = 25
|
|
||||||
Top = 338
|
|
||||||
Width = 495
|
|
||||||
Align = alBottom
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Around = 8
|
|
||||||
BevelOuter = bvNone
|
|
||||||
ClientHeight = 25
|
|
||||||
ClientWidth = 495
|
|
||||||
TabOrder = 5
|
|
||||||
object ResetBtn: TButton
|
|
||||||
AnchorSideLeft.Control = Panel1
|
|
||||||
AnchorSideTop.Control = Panel1
|
|
||||||
AnchorSideRight.Control = ComputeBtn
|
|
||||||
Left = 294
|
|
||||||
Height = 25
|
|
||||||
Top = 0
|
|
||||||
Width = 54
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
Caption = 'Reset'
|
|
||||||
OnClick = ResetBtnClick
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
object ComputeBtn: TButton
|
|
||||||
AnchorSideLeft.Control = Panel1
|
|
||||||
AnchorSideTop.Control = Panel1
|
|
||||||
AnchorSideRight.Control = CloseBtn
|
|
||||||
Left = 356
|
|
||||||
Height = 25
|
|
||||||
Top = 0
|
|
||||||
Width = 76
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
Caption = 'Compute'
|
|
||||||
OnClick = ComputeBtnClick
|
|
||||||
TabOrder = 2
|
|
||||||
end
|
|
||||||
object HelpBtn: TButton
|
|
||||||
Tag = 141
|
|
||||||
AnchorSideLeft.Control = Panel1
|
|
||||||
AnchorSideTop.Control = ResetBtn
|
|
||||||
AnchorSideRight.Control = ResetBtn
|
|
||||||
Left = 235
|
|
||||||
Height = 25
|
|
||||||
Top = 0
|
|
||||||
Width = 51
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
Caption = 'Help'
|
|
||||||
OnClick = HelpBtnClick
|
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object CloseBtn: TButton
|
|
||||||
AnchorSideLeft.Control = Panel1
|
|
||||||
AnchorSideTop.Control = Panel1
|
|
||||||
AnchorSideRight.Control = Panel1
|
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 440
|
Left = 392
|
||||||
Height = 25
|
Height = 23
|
||||||
Top = 0
|
Top = 120
|
||||||
Width = 55
|
Width = 64
|
||||||
|
Alignment = taRightJustify
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
AutoSize = True
|
BorderSpacing.Top = 24
|
||||||
Caption = 'Close'
|
TabOrder = 4
|
||||||
ModalResult = 11
|
Text = 'NEdit'
|
||||||
TabOrder = 3
|
end
|
||||||
|
object Label4: TLabel[10]
|
||||||
|
AnchorSideTop.Control = PEdit
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 272
|
||||||
|
Height = 30
|
||||||
|
Top = 147
|
||||||
|
Width = 108
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
Caption = 'Expected Proportion'#13#10'of Defects:'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object PEdit: TEdit[11]
|
||||||
|
AnchorSideTop.Control = NEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = MeasEdit
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 392
|
||||||
|
Height = 23
|
||||||
|
Top = 151
|
||||||
|
Width = 64
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
TabOrder = 5
|
||||||
|
Text = 'PEdit'
|
||||||
|
end
|
||||||
|
object SigmaOpts: TRadioGroup[12]
|
||||||
|
AnchorSideLeft.Control = MeasEdit
|
||||||
|
AnchorSideTop.Control = PEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = SpecsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 240
|
||||||
|
Height = 128
|
||||||
|
Top = 198
|
||||||
|
Width = 216
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
AutoFill = True
|
||||||
|
BorderSpacing.Top = 24
|
||||||
|
BorderSpacing.Bottom = 8
|
||||||
|
Caption = 'No. of Sigma Units for UCL and LCL'
|
||||||
|
ChildSizing.LeftRightSpacing = 12
|
||||||
|
ChildSizing.TopBottomSpacing = 6
|
||||||
|
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||||
|
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||||
|
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||||
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
|
ChildSizing.ControlsPerLine = 1
|
||||||
|
ClientHeight = 108
|
||||||
|
ClientWidth = 212
|
||||||
|
ItemIndex = 0
|
||||||
|
Items.Strings = (
|
||||||
|
'3 Sigma (default)'
|
||||||
|
'2 Sigma'
|
||||||
|
'1 Sigma'
|
||||||
|
'x Sigmas with x = '
|
||||||
|
)
|
||||||
|
TabOrder = 6
|
||||||
|
object XSigmaEdit: TEdit
|
||||||
|
AnchorSideRight.Control = SigmaOpts
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
|
Left = 128
|
||||||
|
Height = 23
|
||||||
|
Top = 80
|
||||||
|
Width = 72
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
|
TabOrder = 0
|
||||||
|
Text = 'XSigmaEdit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
inherited SpecsSplitter: TSplitter
|
||||||
|
Left = 459
|
||||||
|
end
|
||||||
|
inherited PageControl1: TPageControl
|
||||||
|
Left = 467
|
||||||
|
Width = 454
|
||||||
|
inherited ReportPage: TTabSheet
|
||||||
|
ClientWidth = 446
|
||||||
|
inherited Panel1: TPanel
|
||||||
|
Width = 434
|
||||||
|
ClientWidth = 430
|
||||||
|
inherited ReportMemo: TMemo
|
||||||
|
Width = 422
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
// File for testing: "defects.laz"
|
|
||||||
// Defects --> Measurement Variable
|
|
||||||
// No of parts sampled ---> 1000
|
|
||||||
// Expected proportion of defects --> 0.01
|
|
||||||
|
|
||||||
unit PChartUnit;
|
unit PChartUnit;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
@ -10,167 +5,88 @@ unit PChartUnit;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls,
|
||||||
StdCtrls, ExtCtrls,
|
StdCtrls, BasicSPCUnit;
|
||||||
MainUnit, Globals, Math, OutputUnit, Buttons, BlankFrmUnit, ContextHelpUnit;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TpChartFrm }
|
{ TPChartForm }
|
||||||
|
|
||||||
TpChartFrm = class(TForm)
|
TPChartForm = class(TBasicSPCForm)
|
||||||
Bevel2: TBevel;
|
|
||||||
ComputeBtn: TButton;
|
|
||||||
HelpBtn: TButton;
|
|
||||||
Label5: TLabel;
|
|
||||||
Label6: TLabel;
|
|
||||||
Label7: TLabel;
|
|
||||||
Panel1: TPanel;
|
|
||||||
ResetBtn: TButton;
|
|
||||||
CloseBtn: TButton;
|
|
||||||
XSigmaEdit: TEdit;
|
|
||||||
NEdit: TEdit;
|
|
||||||
PEdit: TEdit;
|
|
||||||
Label3: TLabel;
|
Label3: TLabel;
|
||||||
Label4: TLabel;
|
Label4: TLabel;
|
||||||
MeasEdit: TEdit;
|
NEdit: TEdit;
|
||||||
Label1: TLabel;
|
PEdit: TEdit;
|
||||||
Label2: TLabel;
|
|
||||||
SigmaOpts: TRadioGroup;
|
SigmaOpts: TRadioGroup;
|
||||||
VarList: TListBox;
|
XSigmaEdit: TEdit;
|
||||||
procedure ComputeBtnClick(Sender: TObject);
|
|
||||||
procedure FormActivate(Sender: TObject);
|
procedure FormActivate(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
protected
|
||||||
procedure FormShow(Sender: TObject);
|
procedure Compute; override;
|
||||||
procedure HelpBtnClick(Sender: TObject);
|
procedure Reset; override;
|
||||||
procedure ResetBtnClick(Sender: TObject);
|
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
|
||||||
procedure VarListClick(Sender: TObject);
|
end;
|
||||||
private
|
|
||||||
{ private declarations }
|
|
||||||
FAutoSized: Boolean;
|
|
||||||
procedure PlotMeans(var means: DblDyneVec; NoGrps: integer;
|
|
||||||
UCL, LCL, GrandMean, Target: double);
|
|
||||||
function Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
|
||||||
public
|
|
||||||
{ public declarations }
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
var
|
||||||
pChartFrm: TpChartFrm;
|
PChartForm: TPChartForm;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ TpChartFrm }
|
{$R *.lfm}
|
||||||
|
|
||||||
procedure TpChartFrm.ResetBtnClick(Sender: TObject);
|
uses
|
||||||
|
Math, Globals, Utils, MainUnit, DataProcs;
|
||||||
|
|
||||||
|
procedure TPChartForm.Compute;
|
||||||
var
|
var
|
||||||
i: integer;
|
ColNoSelected: IntDyneVec = nil;
|
||||||
begin
|
obsP: DblDyneVec = nil;
|
||||||
VarList.Clear;
|
X, AVG, P, sigma, variance, stddev, UCL, LCL, maxX: Double;
|
||||||
MeasEdit.Text := '';
|
i, N, count: Integer;
|
||||||
NEdit.Text := '';
|
|
||||||
PEdit.Text := '';
|
|
||||||
for i := 1 to NoVariables do
|
|
||||||
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TpChartFrm.VarListClick(Sender: TObject);
|
|
||||||
var
|
|
||||||
index : integer;
|
|
||||||
begin
|
|
||||||
index := VarList.ItemIndex;
|
|
||||||
if index > -1 then begin
|
|
||||||
MeasEdit.Text := VarList.Items[index];
|
|
||||||
VarList.Items.Delete(index);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TpChartFrm.FormActivate(Sender: TObject);
|
|
||||||
var
|
|
||||||
w: Integer;
|
|
||||||
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;
|
|
||||||
|
|
||||||
VarList.Constraints.MinHeight := SigmaOpts.Top + SigmaOpts.Height - VarList.Top;
|
|
||||||
VarList.Constraints.MinWidth := SigmaOpts.Width * 3 div 4;
|
|
||||||
|
|
||||||
Constraints.MinWidth := Width;
|
|
||||||
Constraints.MinHeight := Height;
|
|
||||||
|
|
||||||
FAutoSized := true;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TpChartFrm.FormCreate(Sender: TObject);
|
|
||||||
begin
|
|
||||||
Assert(OS3MainFrm <> nil);
|
|
||||||
if BlankFrm = nil then
|
|
||||||
Application.CreateForm(TBlankfrm, BlankFrm);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TpChartFrm.FormShow(Sender: TObject);
|
|
||||||
begin
|
|
||||||
ResetBtnClick(self);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TpChartFrm.HelpBtnClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
if ContextHelpForm = nil then
|
|
||||||
Application.CreateForm(TContextHelpForm, ContextHelpForm);
|
|
||||||
ContextHelpForm.HelpMessage((Sender as TButton).tag);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TpChartFrm.ComputeBtnClick(Sender: TObject);
|
|
||||||
var
|
|
||||||
P, N, variance, stddev, UCL, LCL, X, Sigma, AVG: double;
|
|
||||||
i, measvar: integer;
|
|
||||||
cellstring: string;
|
|
||||||
obsp: DblDyneVec;
|
|
||||||
msg: String;
|
|
||||||
C: TWinControl;
|
|
||||||
lReport: TStrings;
|
lReport: TStrings;
|
||||||
begin
|
begin
|
||||||
if not Validate(msg, C) then
|
SetLength(ColNoSelected, 1);
|
||||||
|
ColNoSelected[0] := MeasVar;
|
||||||
|
|
||||||
|
case SigmaOpts.ItemIndex of
|
||||||
|
0: sigma := 3.0;
|
||||||
|
1: sigma := 2.0;
|
||||||
|
2: sigma := 1.0;
|
||||||
|
3: sigma := StrToFloat(XSigmaEdit.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
|
N := StrToInt(NEdit.Text);
|
||||||
|
P := StrToFloat(PEdit.Text);
|
||||||
|
variance := P * (1.0 - P) / N;
|
||||||
|
stddev := sqrt(variance);
|
||||||
|
|
||||||
|
AVG := 0.0;
|
||||||
|
count := 0;
|
||||||
|
maxX := 0;
|
||||||
|
SetLength(obsP, NoCases);
|
||||||
|
for i := 1 to NoCases do
|
||||||
begin
|
begin
|
||||||
C.SetFocus;
|
if not GoodRecord(i, Length(ColNoSelected), ColNoSelected) then continue;
|
||||||
MessageDlg(msg, mtError, [mbOK], 0);
|
X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[MeasVar, i]));
|
||||||
|
if X > maxX then maxX := X;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if maxX > N then
|
||||||
|
begin
|
||||||
|
ErrorMsg(Format('Maximum number of defects (%.0f) cannot be larger than the sample size (%d)', [maxX, N]));
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AVG := 0.0;
|
|
||||||
measvar := 1;
|
|
||||||
Sigma := 3;
|
|
||||||
N := StrToFloat(NEdit.Text);
|
|
||||||
P := StrToFloat(PEdit.Text);
|
|
||||||
case SigmaOpts.ItemIndex of
|
|
||||||
0: Sigma := 3.0;
|
|
||||||
1: Sigma := 2.0;
|
|
||||||
2: Sigma := 1.0;
|
|
||||||
3: Sigma := StrToFloat(XSigmaEdit.Text);
|
|
||||||
end;
|
|
||||||
|
|
||||||
for i := 1 to NoVariables do
|
|
||||||
begin
|
|
||||||
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
|
|
||||||
if cellstring = MeasEdit.Text then measvar := i;
|
|
||||||
end;
|
|
||||||
variance := P * (1.0 - P) / N;
|
|
||||||
stddev := Sqrt(variance);
|
|
||||||
SetLength(obsp, NoCases + 1);
|
|
||||||
for i := 1 to NoCases do
|
for i := 1 to NoCases do
|
||||||
begin
|
begin
|
||||||
X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[measvar,i]));
|
X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[MeasVar, i]));
|
||||||
X := X / N;
|
X := X / N;
|
||||||
obsp[i] := X;
|
obsP[i - 1] := X;
|
||||||
AVG := AVG + X;
|
AVG := AVG + X;
|
||||||
|
inc(count);
|
||||||
end;
|
end;
|
||||||
AVG := AVG / NoCases;
|
SetLength(obsP, count);
|
||||||
|
AVG := AVG / count; //NoCases;
|
||||||
UCL := P + Sigma * stddev;
|
UCL := P + Sigma * stddev;
|
||||||
LCL := P - Sigma * stddev;
|
LCL := P - Sigma * stddev;
|
||||||
|
|
||||||
@ -182,219 +98,121 @@ begin
|
|||||||
lReport.Add('Sample No. Proportion');
|
lReport.Add('Sample No. Proportion');
|
||||||
lReport.Add('---------- ----------');
|
lReport.Add('---------- ----------');
|
||||||
for i := 1 to NoCases do
|
for i := 1 to NoCases do
|
||||||
lReport.Add(' %5d %6.3f', [i, obsp[i]]);
|
lReport.Add('%10d %10.3f', [i, obsp[i]]);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
lReport.Add('Target proportion: %6.4f', [P]);
|
lReport.Add('Number of data values: %8d', [count]);
|
||||||
lReport.Add('Sample size for each observation: %6.0f', [N]);
|
lReport.Add('Target proportion: %8.4f', [P]);
|
||||||
lReport.Add('Average proportion observed %6.4f', [AVG]);
|
lReport.Add('Sample size for each observation: %8d', [N]);
|
||||||
|
lReport.Add('Average proportion observed %8.4f', [AVG]);
|
||||||
|
|
||||||
DisplayReport(lReport);
|
ReportMemo.Lines.Assign(lReport);
|
||||||
finally
|
finally
|
||||||
lReport.Free;
|
lReport.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Now create plot
|
// Show graph
|
||||||
PlotMeans(obsp,NoCases,UCL,LCL, Avg, P);
|
PlotMeans(
|
||||||
|
Format('P Control Chart for "%s"', [GetFileName]),
|
||||||
obsp := nil;
|
'Sample', MeasEdit.Text, 'Proportion', 'Mean',
|
||||||
|
nil, obsP,
|
||||||
|
UCL, LCL, AVG,
|
||||||
|
NaN, NaN, NaN
|
||||||
|
);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TpChartFrm.PlotMeans(var Means: DblDyneVec; NoGrps: integer;
|
procedure TPChartForm.FormActivate(Sender: TObject);
|
||||||
UCL, LCL, GrandMean, Target: double);
|
|
||||||
var
|
var
|
||||||
i, xpos, ypos, hleft, hright, vtop, vbottom, imagewide : integer;
|
w: Integer;
|
||||||
vhi, hwide, offset, strhi, oldxpos : integer;
|
|
||||||
imagehi, maxval, minval, valincr, Yvalue : double;
|
|
||||||
Title : string;
|
|
||||||
begin
|
begin
|
||||||
maxval := -10000.0;
|
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
|
||||||
minval := 10000.0;
|
HelpBtn.Constraints.MinWidth := w;
|
||||||
for i := 1 to NoGrps do
|
ResetBtn.Constraints.MinWidth := w;
|
||||||
begin
|
ComputeBtn.Constraints.MinWidth := w;
|
||||||
if means[i] > maxval then maxval := means[i];
|
CloseBtn.Constraints.MinWidth := w;
|
||||||
if means[i] < minval then minval := means[i];
|
|
||||||
end;
|
|
||||||
if UCL > maxval then maxval := UCL;
|
|
||||||
if LCL < minval then minval := LCL;
|
|
||||||
BlankFrm.Image1.Canvas.Clear;
|
|
||||||
BlankFrm.Show;
|
|
||||||
Title := 'p CONTROL CHART FOR ' + OS3MainFrm.FileNameEdit.Text;
|
|
||||||
BlankFrm.Caption := Title;
|
|
||||||
imagewide := BlankFrm.Image1.Width;
|
|
||||||
imagehi := BlankFrm.Image1.Height;
|
|
||||||
vtop := 20;
|
|
||||||
vbottom := round(imagehi) - 80;
|
|
||||||
vhi := vbottom - vtop;
|
|
||||||
hleft := 100;
|
|
||||||
hright := imagewide - 80;
|
|
||||||
hwide := hright - hleft;
|
|
||||||
|
|
||||||
BlankFrm.Image1.Canvas.Brush.Color := clLtGray;
|
DisableAutoSizing;
|
||||||
BlankFrm.Image1.Canvas.FillRect(0, 0, BlankFrm.Image1.Width, BlankFrm.Image1.Height);
|
try
|
||||||
|
SigmaOpts.AnchorSideRight.Control := nil;
|
||||||
|
VarList.Constraints.MinWidth := VarListLabel.Width;
|
||||||
|
SpecsPanel.Constraints.MinWidth := Max(
|
||||||
|
CloseBtn.Left + CloseBtn.Width - HelpBtn.Left + HelpBtn.BorderSpacing.Around,
|
||||||
|
SigmaOpts.Width * 2 + VarList.BorderSpacing.Right + VarList.BorderSpacing.Left
|
||||||
|
);
|
||||||
|
Constraints.MinHeight := SigmaOpts.Top + SigmaOpts.Height + SigmaOpts.BorderSpacing.Bottom + ButtonPanel.Height;
|
||||||
|
|
||||||
// Draw chart border
|
SigmaOpts.AnchorSideRight.Control := MeasEdit;
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
|
SigmaOpts.AnchorSideRight.Side := asrBottom;
|
||||||
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
|
finally
|
||||||
BlankFrm.Image1.Canvas.Rectangle(hleft,vtop-10,hleft+hwide,vtop+vhi+10);
|
EnableAutoSizing;
|
||||||
|
end;
|
||||||
// draw Grand Mean
|
|
||||||
ypos := round(vhi * ( (maxval - GrandMean) / (maxval - minval)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := hleft;
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
xpos := hright;
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clBlue;
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
Title := 'MEAN';
|
|
||||||
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
|
|
||||||
ypos := ypos - strhi div 2;
|
|
||||||
BlankFrm.Image1.Canvas.Brush.Style := bsClear;
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
|
|
||||||
|
|
||||||
// draw target
|
|
||||||
ypos := round(vhi * ( (maxval - Target) / (maxval - minval)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := hleft;
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
xpos := hright;
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clRed;
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
Title := 'TARGET';
|
|
||||||
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
|
|
||||||
ypos := ypos - strhi div 2;
|
|
||||||
BlankFrm.Image1.Canvas.Brush.Style := bsClear;
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
|
|
||||||
|
|
||||||
// draw horizontal axis
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(hleft,vbottom + 20);
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(hright,vbottom + 20);
|
|
||||||
oldxpos := 0;
|
|
||||||
for i := 1 to NoGrps do
|
|
||||||
begin
|
|
||||||
ypos := vbottom + 10;
|
|
||||||
xpos := round((hwide / NoGrps)* i + hleft);
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
ypos := ypos + 10;
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
Title := format('%d',[i]);
|
|
||||||
offset := BlankFrm.Image1.Canvas.TextWidth(Title) div 2;
|
|
||||||
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
|
|
||||||
xpos := xpos - offset;
|
|
||||||
ypos := ypos + strhi;
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
|
|
||||||
if xpos > oldxpos then
|
|
||||||
begin
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
|
|
||||||
oldxpos := xpos + (offset * 2);
|
|
||||||
end;
|
|
||||||
xpos := 10;
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,'GROUPS:');
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Draw vertical axis
|
|
||||||
valincr := (maxval - minval) / 10.0;
|
|
||||||
for i := 1 to 11 do
|
|
||||||
begin
|
|
||||||
Title := format('%.3f',[maxval - ((i-1)*valincr)]);
|
|
||||||
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
|
|
||||||
xpos := 10;
|
|
||||||
Yvalue := maxval - (valincr * (i-1));
|
|
||||||
ypos := round(vhi * ( (maxval - Yvalue) / (maxval - minval)));
|
|
||||||
ypos := ypos + vtop - strhi div 2;
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
|
|
||||||
end;
|
|
||||||
|
|
||||||
// draw lines for means of the groups
|
|
||||||
ypos := round(vhi * ( (maxval - means[1]) / (maxval - minval)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := round((hwide / NoGrps) + hleft);
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
|
|
||||||
for i := 2 to NoGrps do
|
|
||||||
begin
|
|
||||||
ypos := round(vhi * ( (maxval - means[i]) / (maxval - minval)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := round((hwide / NoGrps)* i + hleft);
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Draw upper and lower confidence intervals
|
|
||||||
ypos := round(vhi * ( (maxval - UCL) / (maxval - minval)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := hleft;
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
xpos := hright;
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clRed;
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
Title := 'UCL';
|
|
||||||
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
|
|
||||||
ypos := ypos - strhi div 2;
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
|
|
||||||
|
|
||||||
ypos := round(vhi * ( (maxval - LCL) / (maxval - minval)));
|
|
||||||
ypos := ypos + vtop;
|
|
||||||
xpos := hleft;
|
|
||||||
BlankFrm.Image1.Canvas.MoveTo(xpos,ypos);
|
|
||||||
xpos := hright;
|
|
||||||
BlankFrm.Image1.Canvas.Pen.Color := clRed;
|
|
||||||
BlankFrm.Image1.Canvas.LineTo(xpos,ypos);
|
|
||||||
Title := 'LCL';
|
|
||||||
strhi := BlankFrm.Image1.Canvas.TextHeight(Title);
|
|
||||||
ypos := ypos - strhi div 2;
|
|
||||||
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPChartFrm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
procedure TPChartForm.Reset;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
XSigmaEdit.Clear;
|
||||||
|
NEdit.Clear;
|
||||||
|
PEdit.Clear;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TPChartForm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
||||||
var
|
var
|
||||||
n: Integer;
|
|
||||||
x: Double;
|
x: Double;
|
||||||
|
n: Integer;
|
||||||
begin
|
begin
|
||||||
|
Result := inherited;
|
||||||
|
if not Result then
|
||||||
|
exit;
|
||||||
|
|
||||||
Result := false;
|
Result := false;
|
||||||
|
|
||||||
if MeasEdit.Text = '' then
|
if (NEdit.Text = '') then
|
||||||
begin
|
begin
|
||||||
AMsg := 'Measurement variable not specified.';
|
AMsg := 'No of Parts Sampled not specified.';
|
||||||
AControl := MeasEdit;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if NEdit.Text = '' then
|
|
||||||
begin
|
|
||||||
AMsg := 'Number of sampled parts is not specified.';
|
|
||||||
AControl := NEdit;
|
AControl := NEdit;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if not TryStrToInt(NEdit.Text, n) then
|
if not TryStrToInt(NEdit.Text, n) then
|
||||||
begin
|
begin
|
||||||
AMsg := 'Number of sampled parts is not valid.';
|
AMsg := 'No valid number given for No of Parts Sampled.';
|
||||||
AControl := NEdit;
|
AControl := NEdit;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if PEdit.Text = '' then
|
if (PEdit.Text = '') then
|
||||||
begin
|
begin
|
||||||
AMsg := 'Expected proportion of defects is not specified.';
|
AMsg := 'Expected proportion of defects not specifed.';
|
||||||
AControl := PEdit;
|
AControl := PEdit;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if not TryStrToFloat(PEdit.Text, x) then
|
if not TryStrToFloat(PEdit.Text, x) then
|
||||||
begin
|
begin
|
||||||
AMsg := 'Expected proporton of defects is not a valid number.';
|
AMsg := 'No valid number given for expected proportion of defects.';
|
||||||
AControl := PEdit;
|
AControl := PEdit;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if SigmaOpts.ItemIndex = -1 then
|
||||||
|
begin
|
||||||
|
AMsg := 'Number of sigma units for UCL and LCL not specified.';
|
||||||
|
AControl := SigmaOpts;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
if SigmaOpts.ItemIndex = 3 then
|
if SigmaOpts.ItemIndex = 3 then
|
||||||
begin
|
begin
|
||||||
if XSigmaEdit.Text = '' then
|
if (XSigmaEdit.Text = '') then
|
||||||
begin
|
begin
|
||||||
AMsg := 'X Sigma is not specified.';
|
AMsg := 'User-defined sigma units missing.';
|
||||||
AControl := XSigmaEdit;
|
AControl := XSigmaEdit;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if not TryStrToFloat(XSigmaEdit.Text, x) then
|
if not TryStrToFloat(XSigmaEdit.Text, x) then
|
||||||
begin
|
begin
|
||||||
AMsg := 'X Sigma is not a valid number.';
|
AMsg := 'No valid number given for sser-defined sigma units.';
|
||||||
AControl := XSigmaEdit;
|
AControl := XSigmaEdit;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -403,8 +221,6 @@ begin
|
|||||||
Result := true;
|
Result := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
|
||||||
{$I pchartunit.lrs}
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
@ -926,9 +926,9 @@ end;
|
|||||||
// Menu "Analysis" > "Statistical Process Control" > "p Control Chart"
|
// Menu "Analysis" > "Statistical Process Control" > "p Control Chart"
|
||||||
procedure TOS3MainFrm.mnuAnalysisSPC_PChartClick(Sender: TObject);
|
procedure TOS3MainFrm.mnuAnalysisSPC_PChartClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if pChartFrm = nil then
|
if PChartForm = nil then
|
||||||
Application.CreateForm(TpChartFrm, pChartFrm);
|
Application.CreateForm(TPChartForm, PChartForm);
|
||||||
pChartFrm.ShowModal;
|
PChartForm.ShowModal;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Menu "Analysis" > "Descriptive" > "Plot X vs Y"
|
// Menu "Analysis" > "Descriptive" > "Plot X vs Y"
|
||||||
|
Reference in New Issue
Block a user