LazStats: Refactor RChartUnit and XBarUnit to inherit from SPC template form.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7654 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-09-07 21:24:22 +00:00
parent d7567a511a
commit c0ccf0b079
13 changed files with 794 additions and 2061 deletions

View File

@ -744,682 +744,682 @@
<UnitName Value="KaplanMeierUnit"/>
</Unit88>
<Unit89>
<Filename Value="forms\analysis\statistical_process_control\xbarunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="XBarFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="XBarUnit"/>
</Unit89>
<Unit90>
<Filename Value="forms\analysis\statistical_process_control\rchartunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="RChartFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RChartUnit"/>
</Unit90>
<Unit91>
<Filename Value="forms\analysis\statistical_process_control\cumsumunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="CUMSUMFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="CUMSUMUnit"/>
</Unit91>
<Unit92>
</Unit89>
<Unit90>
<Filename Value="forms\analysis\statistical_process_control\cchartunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="cChartFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="CChartUnit"/>
</Unit92>
<Unit93>
</Unit90>
<Unit91>
<Filename Value="forms\analysis\statistical_process_control\pchartunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="pChartFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="PChartUnit"/>
</Unit93>
<Unit94>
</Unit91>
<Unit92>
<Filename Value="forms\analysis\statistical_process_control\uchartunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="UChartFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="UChartUnit"/>
</Unit94>
<Unit95>
</Unit92>
<Unit93>
<Filename Value="forms\simulations\corsimunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="CorSimFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="CorSimUnit"/>
</Unit95>
<Unit96>
</Unit93>
<Unit94>
<Filename Value="forms\simulations\multgenunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MultGenFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="MultGenUnit"/>
</Unit96>
<Unit97>
</Unit94>
<Unit95>
<Filename Value="forms\simulations\errorcurvesunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ErrorCurvesFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ErrorCurvesUnit"/>
</Unit97>
<Unit98>
</Unit95>
<Unit96>
<Filename Value="forms\simulations\pcurvesunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="PCurvesFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="PCurvesUnit"/>
</Unit98>
<Unit99>
</Unit96>
<Unit97>
<Filename Value="forms\simulations\distribunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="DistribFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="DistribUnit"/>
</Unit99>
<Unit100>
</Unit97>
<Unit98>
<Filename Value="forms\simulations\gensequnit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="GenSeqFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="GenSeqUnit"/>
</Unit100>
<Unit101>
</Unit98>
<Unit99>
<Filename Value="forms\simulations\genrndvalsunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="GenRndValsFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="GenRndValsUnit"/>
</Unit101>
<Unit102>
</Unit99>
<Unit100>
<Filename Value="forms\analysis\financial\loanitunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="LoanItFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="LoanItUnit"/>
</Unit102>
<Unit103>
</Unit100>
<Unit101>
<Filename Value="forms\analysis\financial\sumyrsdepunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SumYrsDepFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SumYrsDepUnit"/>
</Unit103>
<Unit104>
</Unit101>
<Unit102>
<Filename Value="forms\analysis\financial\sldunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SLDepFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SLDUnit"/>
</Unit104>
<Unit105>
</Unit102>
<Unit103>
<Filename Value="forms\analysis\financial\dbldeclineunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="DblDeclineFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="DblDeclineUnit"/>
</Unit105>
<Unit106>
</Unit103>
<Unit104>
<Filename Value="forms\analysis\nonparametric\riditunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="RIDITFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RIDITUnit"/>
</Unit106>
<Unit107>
</Unit104>
<Unit105>
<Filename Value="forms\analysis\multiple_regression\twoslsunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="TwoSLSFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TwoSLSUnit"/>
</Unit107>
<Unit108>
</Unit105>
<Unit106>
<Filename Value="forms\analysis\multiple_regression\wlsunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="WLSFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="WLSUnit"/>
</Unit108>
<Unit109>
</Unit106>
<Unit107>
<Filename Value="forms\analysis\multivariate\avglinkunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="AvgLinkFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="AvgLinkUnit"/>
</Unit109>
<Unit110>
</Unit107>
<Unit108>
<Filename Value="forms\tools\sortcasesunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SortCasesFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SortCasesUnit"/>
</Unit110>
<Unit111>
</Unit108>
<Unit109>
<Filename Value="forms\tools\selectcasesunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SelectFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SelectCasesUnit"/>
</Unit111>
<Unit112>
</Unit109>
<Unit110>
<Filename Value="forms\tools\selectifunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SelectIfFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SelectIfUnit"/>
</Unit112>
<Unit113>
</Unit110>
<Unit111>
<Filename Value="forms\tools\randomsampunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="RandomSampFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RandomSampUnit"/>
</Unit113>
<Unit114>
</Unit111>
<Unit112>
<Filename Value="forms\tools\rangeselectunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="RangeSelectFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RangeSelectUnit"/>
</Unit114>
<Unit115>
</Unit112>
<Unit113>
<Filename Value="forms\help\gridhelpunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="GridHelpFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="GridHelpUnit"/>
</Unit115>
<Unit116>
</Unit113>
<Unit114>
<Filename Value="forms\variables\recodeunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="RecodeFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RecodeUnit"/>
</Unit116>
<Unit117>
</Unit114>
<Unit115>
<Filename Value="forms\analysis\nonparametric\kappaunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="WeightedKappaFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="KappaUnit"/>
</Unit117>
<Unit118>
</Unit115>
<Unit116>
<Filename Value="forms\analysis\multivariate\kmeansunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="KMeansFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="KMeansUnit"/>
</Unit118>
<Unit119>
</Unit116>
<Unit117>
<Filename Value="forms\analysis\multivariate\singlelinkunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SingleLinkFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SingleLinkUnit"/>
</Unit119>
<Unit120>
</Unit117>
<Unit118>
<Filename Value="forms\analysis\nonparametric\genkappaunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="GenKappaFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="GenKappaUnit"/>
</Unit120>
<Unit121>
</Unit118>
<Unit119>
<Filename Value="forms\analysis\matrix_manipulation\matmanunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MatManFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="MatManUnit"/>
</Unit121>
<Unit122>
</Unit119>
<Unit120>
<Filename Value="forms\analysis\matrix_manipulation\scripteditorunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ScriptEditorFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ScriptEditorUnit"/>
</Unit122>
<Unit123>
</Unit120>
<Unit121>
<Filename Value="forms\analysis\matrix_manipulation\rootmethodunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="RootMethodFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RootMethodUnit"/>
</Unit123>
<Unit124>
</Unit121>
<Unit122>
<Filename Value="forms\analysis\matrix_manipulation\scriptoptsunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ScriptOptsFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ScriptOptsUnit"/>
</Unit124>
<Unit125>
</Unit122>
<Unit123>
<Filename Value="forms\analysis\matrix_manipulation\colinsertunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ColInsertFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ColInsertUnit"/>
</Unit125>
<Unit126>
</Unit123>
<Unit124>
<Filename Value="forms\analysis\matrix_manipulation\rowinsertunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="RowInsertFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RowInsertUnit"/>
</Unit126>
<Unit127>
</Unit124>
<Unit125>
<Filename Value="forms\analysis\measurement_programs\gradebookunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="GradebookFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="GradeBookUnit"/>
</Unit127>
<Unit128>
</Unit125>
<Unit126>
<Filename Value="forms\analysis\measurement_programs\gradingunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="GradingFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="GradingUnit"/>
</Unit128>
<Unit129>
</Unit126>
<Unit127>
<Filename Value="forms\simulations\probzunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ProbzForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ProbZUnit"/>
</Unit129>
<Unit130>
</Unit127>
<Unit128>
<Filename Value="forms\simulations\probsmallerzunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ProbSmallerzForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ProbSmallerZUnit"/>
</Unit130>
<Unit131>
</Unit128>
<Unit129>
<Filename Value="forms\simulations\twozprobunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="TwozProbForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TwoZProbUnit"/>
</Unit131>
<Unit132>
</Unit129>
<Unit130>
<Filename Value="forms\simulations\inversezunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="InversezForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="InverseZUnit"/>
</Unit132>
<Unit133>
</Unit130>
<Unit131>
<Filename Value="forms\simulations\probchisqrunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ChiSqrProbForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ProbChiSqrUnit"/>
</Unit133>
<Unit134>
</Unit131>
<Unit132>
<Filename Value="forms\simulations\tprobunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="TprobForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="tProbUnit"/>
</Unit134>
<Unit135>
</Unit132>
<Unit133>
<Filename Value="forms\simulations\fprobunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="FForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="FProbUnit"/>
</Unit135>
<Unit136>
</Unit133>
<Unit134>
<Filename Value="forms\simulations\hypergeounit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="HyperGeoForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="HyperGeoUnit"/>
</Unit136>
<Unit137>
</Unit134>
<Unit135>
<Filename Value="forms\analysis\comparisons\bnestaunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="BNestedAForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="BNestAUnit"/>
</Unit137>
<Unit138>
</Unit135>
<Unit136>
<Filename Value="forms\analysis\comparisons\abcnestedunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ABCNestedForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ABCNestedUnit"/>
</Unit138>
<Unit139>
</Unit136>
<Unit137>
<Filename Value="forms\analysis\multivariate\bartletttestunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="BartlettTestForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="BartlettTestUnit"/>
</Unit139>
<Unit140>
</Unit137>
<Unit138>
<Filename Value="forms\tools\datasmoothunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SmoothDataForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="DataSmoothUnit"/>
</Unit140>
<Unit141>
</Unit138>
<Unit139>
<Filename Value="forms\analysis\descriptive\groupfrequnit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="GroupFreqForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="GroupFreqUnit"/>
</Unit141>
<Unit142>
</Unit139>
<Unit140>
<Filename Value="forms\analysis\nonparametric\runstestunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="runstestform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RunsTestUnit"/>
</Unit142>
<Unit143>
</Unit140>
<Unit141>
<Filename Value="forms\analysis\descriptive\xvsmultyunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="XvsMultYForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="XvsMultYUnit"/>
</Unit143>
<Unit144>
</Unit141>
<Unit142>
<Filename Value="forms\analysis\nonparametric\sensunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SensForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SensUnit"/>
</Unit144>
<Unit145>
</Unit142>
<Unit143>
<Filename Value="forms\analysis\multivariate\correspondenceunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="CorrespondenceForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="CorrespondenceUnit"/>
</Unit145>
<Unit146>
</Unit143>
<Unit144>
<Filename Value="forms\analysis\descriptive\comparedistunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="CompareDistFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="CompareDistUnit"/>
</Unit146>
<Unit147>
</Unit144>
<Unit145>
<Filename Value="forms\variables\equationunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="EquationForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="EquationUnit"/>
</Unit147>
<Unit148>
</Unit145>
<Unit146>
<Filename Value="forms\misc\contexthelpunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ContextHelpForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ContextHelpUnit"/>
</Unit148>
<Unit149>
</Unit146>
<Unit147>
<Filename Value="forms\tools\calculatorunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="CalculatorForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="CalculatorUnit"/>
</Unit149>
<Unit150>
</Unit147>
<Unit148>
<Filename Value="forms\tools\jpegunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="JPEGform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="JpegUnit"/>
</Unit150>
<Unit151>
</Unit148>
<Unit149>
<Filename Value="forms\analysis\descriptive\resistancelineunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ResistanceLineForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ResistanceLineUnit"/>
</Unit151>
<Unit152>
</Unit149>
<Unit150>
<Filename Value="forms\analysis\multivariate\medianpolishunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MedianPolishForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="MedianPolishUnit"/>
</Unit152>
<Unit153>
</Unit150>
<Unit151>
<Filename Value="forms\analysis\comparisons\onecaseanovaunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="OneCaseAnovaForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="OneCaseANOVAUnit"/>
</Unit153>
<Unit154>
</Unit151>
<Unit152>
<Filename Value="forms\analysis\descriptive\smoothdataunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="DataSmoothingForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SmoothDataUnit"/>
</Unit154>
<Unit155>
</Unit152>
<Unit153>
<Filename Value="forms\analysis\nonparametric\srhtestunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SRHTest"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SRHTestUnit"/>
</Unit155>
<Unit156>
</Unit153>
<Unit154>
<Filename Value="forms\help\aboutunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="AboutBox"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="AboutUnit"/>
</Unit156>
<Unit157>
</Unit154>
<Unit155>
<Filename Value="forms\analysis\measurement_programs\item_banking\itembankingunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ItemBankFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ItemBankingUnit"/>
</Unit157>
<Unit158>
</Unit155>
<Unit156>
<Filename Value="forms\analysis\measurement_programs\item_banking\itemcodesunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="CodesForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ItemCodesUnit"/>
</Unit158>
<Unit159>
</Unit156>
<Unit157>
<Filename Value="forms\analysis\measurement_programs\item_banking\tfitemunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="TFItemForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TFItemUnit"/>
</Unit159>
<Unit160>
</Unit157>
<Unit158>
<Filename Value="forms\analysis\measurement_programs\item_banking\essayitemunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="EssayItemForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="EssayItemUnit"/>
</Unit160>
<Unit161>
</Unit158>
<Unit159>
<Filename Value="forms\analysis\measurement_programs\item_banking\mcitemunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MCItemForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="MCItemUnit"/>
</Unit161>
<Unit162>
</Unit159>
<Unit160>
<Filename Value="forms\analysis\measurement_programs\item_banking\matchitemunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MatchItemForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="MatchItemUnit"/>
</Unit162>
<Unit163>
</Unit160>
<Unit161>
<Filename Value="forms\analysis\measurement_programs\item_banking\testspecsunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="TestSpecsForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TestSpecsUnit"/>
</Unit163>
<Unit164>
</Unit161>
<Unit162>
<Filename Value="forms\analysis\nonparametric\simplechisqrunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SimpleChiSqrForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SimpleChiSqrUnit"/>
</Unit164>
<Unit165>
</Unit162>
<Unit163>
<Filename Value="forms\analysis\nonparametric\lifetableunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="LifeTableForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="LifeTableUnit"/>
</Unit165>
<Unit166>
</Unit163>
<Unit164>
<Filename Value="forms\analysis\multiple_regression\lsmrunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="LSMregForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="LSMRUnit"/>
</Unit166>
<Unit167>
</Unit164>
<Unit165>
<Filename Value="forms\maindm.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MainDataModule"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="DataModule"/>
<UnitName Value="MainDM"/>
</Unit167>
<Unit168>
</Unit165>
<Unit166>
<Filename Value="units\utils.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Utils"/>
</Unit168>
<Unit169>
</Unit166>
<Unit167>
<Filename Value="LazStats.inc"/>
<IsPartOfProject Value="True"/>
</Unit169>
<Unit170>
</Unit167>
<Unit168>
<Filename Value="forms\misc\chartunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ChartForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ChartUnit"/>
</Unit170>
<Unit171>
</Unit168>
<Unit169>
<Filename Value="units\mathunit.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="MathUnit"/>
</Unit171>
<Unit172>
</Unit169>
<Unit170>
<Filename Value="frames\chartframeunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ChartFrame"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="ChartFrameUnit"/>
</Unit172>
<Unit173>
</Unit170>
<Unit171>
<Filename Value="forms\analysis\statistical_process_control\basicspcunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="BasicSPCForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="BasicSPCUnit"/>
</Unit173>
<Unit174>
</Unit171>
<Unit172>
<Filename Value="forms\analysis\statistical_process_control\schartunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SChartForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="SChartUnit"/>
</Unit172>
<Unit173>
<Filename Value="forms\analysis\statistical_process_control\rchartunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="RChartForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RChartUnit"/>
</Unit173>
<Unit174>
<Filename Value="forms\analysis\statistical_process_control\xbarchartunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="XBarChartForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="XBarChartUnit"/>
</Unit174>
</Units>
</ProjectOptions>

View File

@ -9,7 +9,7 @@ uses
Interfaces, // this includes the LCL widgetset
Forms, tachartlazaruspkg, tachartprint, lhelpcontrolpkg, Globals, LicenseUnit,
OptionsUnit, MainDM, MainUnit, MathUnit, BasicSPCUnit,
SChartUnit; //, utils, chartunit;
SChartUnit, rchartunit, XBarChartUnit; //, utils, chartunit;
{$R LazStats.res}
@ -29,6 +29,8 @@ begin
end;
Application.CreateForm(TMainDataModule, MainDataModule);
Application.CreateForm(TOS3MainFrm, OS3MainFrm);
Application.CreateForm(TRChartForm, RChartForm);
Application.CreateForm(TXBarChartForm, XBarChartForm);
Application.Run;
end.

View File

@ -211,44 +211,47 @@ object BasicSPCForm: TBasicSPCForm
end
end
object SpecsSplitter: TSplitter
Left = 357
Left = 361
Height = 438
Top = 0
Width = 5
ResizeStyle = rsPattern
end
object PageControl1: TPageControl
Left = 368
Left = 370
Height = 426
Top = 6
Width = 553
Width = 551
ActivePage = ReportPage
Align = alClient
BorderSpacing.Around = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
TabIndex = 0
TabOrder = 2
object ReportPage: TTabSheet
Caption = 'Report'
ClientHeight = 398
ClientWidth = 545
ClientWidth = 543
object Panel1: TPanel
Left = 6
Height = 386
Top = 6
Width = 533
Width = 531
Align = alClient
BorderSpacing.Around = 6
BevelOuter = bvNone
BorderStyle = bsSingle
ClientHeight = 382
ClientWidth = 529
ClientWidth = 527
TabOrder = 0
object ReportMemo: TMemo
Left = 0
Height = 382
Top = 0
Width = 529
Left = 4
Height = 374
Top = 4
Width = 519
Align = alClient
BorderSpacing.Around = 4
BorderStyle = bsNone
Font.Height = -11
Font.Name = 'Courier New'

View File

@ -55,7 +55,7 @@ type
function GetGroups: StrDyneVec;
function GetFileName: String;
procedure PlotMeans(ATitle, AXTitle, AYTitle, ADataTitle, AGrandMeanTitle: String;
const Groups: StrDyneVec; const Means, StdDevs: DblDyneVec;
const Groups: StrDyneVec; const Means: DblDyneVec;
UCL, LCL, GrandMean, TargetSpec, LowerSpec, UpperSpec: double);
procedure Reset; virtual;
procedure Compute; virtual;
@ -214,7 +214,7 @@ end;
procedure TBasicSPCForm.PlotMeans(ATitle, AXTitle, AYTitle, ADataTitle, AGrandMeanTitle: String;
const Groups: StrDyneVec; const Means, StdDevs: DblDyneVec;
const Groups: StrDyneVec; const Means: DblDyneVec;
UCL, LCL, GrandMean, TargetSpec, LowerSpec, UpperSpec: double);
const
TARGET_COLOR = clBlue;
@ -237,7 +237,7 @@ begin
FChartFrame.SetXTitle(AXTitle);
FChartFrame.SetYTitle(AYTitle);
ser := FChartFrame.PlotXY(ptSymbols, nil, Means, Groups, StdDevs, ADataTitle, clBlack);
ser := FChartFrame.PlotXY(ptSymbols, nil, Means, Groups, nil, ADataTitle, clBlack);
FChartFrame.Chart.BottomAxis.Marks.Source := ser.Source;
FChartFrame.Chart.BottomAxis.Marks.style := smsLabel;
@ -272,7 +272,7 @@ begin
else
s := 'Upper/Lower Spec';
constLine := FChartFrame.HorLine(LowerSpec, SPEC_COLOR, SPEC_STYLE, s);
constLine.Legend.Visible := not IsNaN(UpperSpec); //UpSpecChk.Checked;
constLine.Legend.Visible := IsNaN(UpperSpec);
rightLabels.Add(LowerSpec, LowerSpec, 'Lower Spec');
end;
end;

View File

@ -1,293 +1,9 @@
object RChartFrm: TRChartFrm
Left = 688
Height = 476
Top = 126
Width = 875
inherited RChartForm: TRChartForm
HelpType = htKeyword
HelpKeyword = 'html/RangeChart.htm'
Caption = 'Range Chart'
ChildSizing.ControlsPerLine = 1
ClientHeight = 476
ClientWidth = 875
OnActivate = FormActivate
OnCreate = FormCreate
OnShow = FormShow
Position = poMainFormCenter
LCLVersion = '2.1.0.0'
object SpecsPanel: TPanel
Left = 0
Height = 476
Top = 0
Width = 378
Align = alLeft
BevelOuter = bvNone
ClientHeight = 476
ClientWidth = 378
TabOrder = 0
object GroupLabel: TLabel
AnchorSideLeft.Control = GroupEdit
AnchorSideTop.Control = SpecsPanel
Left = 222
Height = 15
Top = 8
Width = 77
BorderSpacing.Top = 8
Caption = 'Group Variable'
ParentColor = False
end
object MeasLabel: TLabel
AnchorSideLeft.Control = MeasEdit
AnchorSideTop.Control = GroupEdit
AnchorSideTop.Side = asrBottom
Left = 222
Height = 15
Top = 64
Width = 117
BorderSpacing.Top = 16
Caption = 'Measurement Variable'
ParentColor = False
end
object GroupEdit: TEdit
AnchorSideLeft.Control = CenterBevel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = GroupLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SpecsPanel
AnchorSideRight.Side = asrBottom
Left = 222
Height = 23
Top = 25
Width = 156
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
TabOrder = 1
Text = 'GroupEdit'
end
object MeasEdit: TEdit
AnchorSideLeft.Control = CenterBevel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = MeasLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SpecsPanel
AnchorSideRight.Side = asrBottom
Left = 222
Height = 23
Top = 81
Width = 156
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
TabOrder = 2
Text = 'MeasEdit'
end
object VarListLabel: TLabel
AnchorSideLeft.Control = SpecsPanel
AnchorSideTop.Control = SpecsPanel
Left = 8
Height = 15
Top = 8
Width = 97
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Selection Variables'
ParentColor = False
end
object VarList: TListBox
AnchorSideLeft.Control = SpecsPanel
AnchorSideTop.Control = VarListLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CenterBevel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonBevel
Left = 8
Height = 402
Top = 25
Width = 206
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
ItemHeight = 0
OnClick = VarListClick
TabOrder = 0
end
object ButtonPanel: TPanel
AnchorSideLeft.Control = SpecsPanel
AnchorSideRight.Control = SpecsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = SpecsPanel
Left = 0
Height = 25
Top = 443
Width = 378
Align = alBottom
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Bottom = 8
BevelOuter = bvNone
ClientHeight = 25
ClientWidth = 378
TabOrder = 3
object ResetBtn: TButton
AnchorSideLeft.Control = ButtonPanel
AnchorSideTop.Control = ButtonPanel
AnchorSideRight.Control = ComputeBtn
Left = 177
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 = ButtonPanel
AnchorSideTop.Control = ButtonPanel
AnchorSideRight.Control = CloseBtn
Left = 239
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 = ButtonPanel
AnchorSideTop.Control = ResetBtn
AnchorSideRight.Control = ResetBtn
Left = 118
Height = 25
Top = 0
Width = 51
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 8
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 0
end
object CloseBtn: TButton
AnchorSideLeft.Control = ButtonPanel
AnchorSideTop.Control = ButtonPanel
AnchorSideRight.Control = ButtonPanel
AnchorSideRight.Side = asrBottom
Left = 323
Height = 25
Top = 0
Width = 55
Anchors = [akTop, akRight]
AutoSize = True
Caption = 'Close'
ModalResult = 11
TabOrder = 3
end
end
object ButtonBevel: TBevel
AnchorSideLeft.Control = SpecsPanel
AnchorSideTop.Control = ButtonPanel
AnchorSideRight.Control = SpecsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonPanel
Left = 0
Height = 8
Top = 427
Width = 378
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object CenterBevel: TBevel
AnchorSideLeft.Control = SpecsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = SpecsPanel
Left = 165
Height = 10
Top = 0
Width = 49
Shape = bsSpacer
end
end
object Splitter1: TSplitter
Left = 378
Height = 476
Top = 0
Width = 5
ResizeStyle = rsPattern
end
object PageControl1: TPageControl
Left = 385
Height = 460
Top = 8
Width = 482
ActivePage = ChartPage
Align = alClient
BorderSpacing.Left = 2
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
TabIndex = 1
TabOrder = 2
object ReportPage: TTabSheet
Caption = 'Report'
ClientHeight = 432
ClientWidth = 474
object ReportMemo: TMemo
Left = 6
Height = 420
Top = 6
Width = 462
Align = alClient
BorderSpacing.Around = 6
Font.Height = -11
Font.Name = 'Courier New'
ParentFont = False
TabOrder = 0
end
end
object ChartPage: TTabSheet
Caption = 'Chart'
ClientHeight = 432
ClientWidth = 474
object ToolBar1: TToolBar
Left = 444
Height = 420
Top = 6
Width = 24
Align = alRight
AutoSize = True
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
Caption = 'ToolBar1'
EdgeBorders = []
Images = MainDataModule.ImageList
TabOrder = 0
Transparent = True
object tbSave: TToolButton
Left = 1
Hint = 'Save chart to file'
Top = 0
Caption = 'tbSave'
ImageIndex = 4
OnClick = tbSaveClick
end
object tbPrint: TToolButton
Left = 1
Hint = 'Print chart'
Top = 22
Caption = 'tbPrint'
ImageIndex = 5
OnClick = tbPrintClick
end
end
end
inherited SpecsPanel: TPanel
HelpType = htKeyword
HelpKeyword = 'html/RangeChart.htm'
end
end

View File

@ -1,103 +1,31 @@
// File for testing: "boltsize.laz"
// LotNo --> Group Variable
// BoltLngth --> Measurement Variable
unit RChartUnit;
{$mode objfpc}{$H+}
{$include ../../../LazStats.inc}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Printers, ExtCtrls, Buttons, ComCtrls,
MainUnit, Globals, GraphLib, ContextHelpUnit,
{$IFDEF USE_TACHART}
TAChartUtils, TASources, TACustomSeries, TASeries, TALegend, TAChartAxisUtils,
ChartFrameUnit;
{$ELSE}
OutputUnit, BlankFrmUnit;
{$ENDIF}
Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
BasicSPCUnit;
type
{ TRChartFrm }
TRChartFrm = class(TForm)
CenterBevel: TBevel;
ButtonBevel: TBevel;
HelpBtn: TButton;
ReportMemo: TMemo;
PageControl1: TPageControl;
ButtonPanel: TPanel;
SpecsPanel: TPanel;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
MeasEdit: TEdit;
GroupEdit: TEdit;
tbPrint: TToolButton;
tbSave: TToolButton;
ToolBar1: TToolBar;
VarListLabel: TLabel;
GroupLabel: TLabel;
MeasLabel: TLabel;
Splitter1: TSplitter;
ReportPage: TTabSheet;
ChartPage: TTabSheet;
VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure tbPrintClick(Sender: TObject);
procedure tbSaveClick(Sender: TObject);
procedure VarListClick(Sender: TObject);
private
{ private declarations }
{$IFDEF USE_TACHART}
FChartFrame: TChartFrame;
{$ENDIF}
procedure PlotMeans(const Groups: StrDyneVec; const Means: DblDyneVec;
UCL, LCL, GrandMean: double);
public
{ public declarations }
end;
TRChartForm = class(TBasicSPCForm)
protected
procedure Compute; override;
end;
var
RChartFrm: TRChartFrm;
RChartForm: TRChartForm;
implementation
{$R *.lfm}
uses
Math, Utils;
Math,
Globals, Utils, MainUnit;
{ TRChartFrm }
procedure TRChartFrm.ComputeBtnClick(Sender: TObject);
var
i, j, GrpVar, MeasVar, grpsize : integer;
oldgrpsize : integer;
X, UCL, LCL: double;
xmin, xmax, GrandMean, GrandSD, semean, D3Value, D4Value : double;
GrandRange : double;
grp: String;
grpIndex, numGrps: Integer;
groups: StrDyneVec = nil;
means: DblDyneVec = nil;
stddev: DblDyneVec = nil;
ranges: DblDyneVec = nil;
count: IntDyneVec;
cellstring: string;
sizeError: boolean;
lReport: TStrings;
procedure TRChartForm.Compute;
const
D3: array[1..24] of double = (
0,0,0,0,0,0.076,0.136,0.184,0.223,0.256,0.283,0.307,0.328,
@ -109,51 +37,38 @@ const
1.744, 1.717, 1.693, 1.672, 1.653, 1.637, 1.622, 1.608,1.597,
1.585, 1.575, 1.566, 1.557, 1.548, 1.541
);
var
i, j: Integer;
grp: String;
grpIndex, grpSize, oldGrpSize, numGrps: Integer;
groups: StrDyneVec = nil;
means: DblDyneVec = nil;
stddev: DblDyneVec = nil;
ranges: DblDynevec = nil;
count: IntDyneVec = nil;
ColNoSelected: IntDyneVec = nil;
X, Xsq, xmin, xmax: Double;
seMean, grandMean, grandRange, grandSD, UCL, LCL: Double;
D3Value, D4Value: Double;
sizeError: boolean;
lReport: TStrings;
begin
if (GroupEdit.Text = '') then
begin
MessageDlg('Group variable is not specified.', mtError, [mbOk], 0);
exit;
end;
SetLength(ColNoSelected, 2);
ColNoSelected[0] := GrpVar;
ColNoSelected[1] := MeasVar;
if (MeasEdit.Text = '') then
begin
MessageDlg('Measurement variable is not specified.', mtError, [mbOK], 0);
exit;
end;
grpSize := 0;
oldGrpSize := 0;
groups := GetGroups;
numGrps := Length(groups);
GrpVar := 1;
MeasVar := 2;
grpsize := 0;
oldgrpsize := 0;
for i := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
if cellstring = GroupEdit.Text then GrpVar := i;
if cellstring = MeasEdit.Text then MeasVar := i;
end;
numGrps := 0;
SetLength(groups, NoCases);
for i := 1 to NoCases do
begin
grp := Trim(OS3MainFrm.DataGrid.Cells[GrpVar, i]);
if IndexOfString(groups, grp) = -1 then
begin
groups[numGrps] := grp;
inc(numGrps);
end;
end;
SetLength(groups, numGrps);
SetLength(means, numGrps);
SetLength(count, numGrps);
SetLength(stddev, numGrps);
SetLength(ranges, numGrps);
semean := 0.0;
GrandMean := 0.0;
GrandRange := 0.0;
seMean := 0.0;
grandMean := 0.0;
grandRange := 0.0;
sizeError := false;
// calculate group ranges, grand mean, group sd's, semeans
@ -169,18 +84,19 @@ begin
if grpIndex = j then
begin
X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[MeasVar, i]));
Xsq := X * X;
if X > xmax then xmax := X;
if X < xmin then xmin := X;
means[grpIndex] := means[grpIndex] + X;
count[grpIndex] := count[grpIndex] + 1;
stddev[grpIndex] := stddev[grpIndex] + X*X;
seMean := seMean + X*X;
GrandMean := GrandMean + X;
stddev[grpIndex] := stddev[grpIndex] + Xsq;
seMean := seMean + Xsq;
grandMean := grandMean + X;
end;
end; // next case
ranges[j] := xMax - xMin;
GrandRange := GrandRange + ranges[j];
grandRange := grandRange + ranges[j];
grpSize := count[j];
if j = 0 then oldGrpSize := grpSize;
if oldGrpSize <> grpSize then sizeError := true;
@ -188,7 +104,7 @@ begin
if (grpsize < 2) or (grpsize > 25) or sizeError then
begin
MessageDlg('Group sizes error.', mtError, [mbOk], 0);
ErrorMsg('Group size error.');
exit;
end;
@ -199,34 +115,27 @@ begin
stddev[i] := sqrt(stddev[i]);
means[i] := means[i] / count[i];
end;
semean := semean - GrandMean * GrandMean / NoCases;
semean := semean / (NoCases - 1);
semean := sqrt(semean);
GrandSD := semean;
semean := semean / sqrt(NoCases);
GrandMean := GrandMean / NoCases;
GrandRange := GrandRange / numGrps;
D3Value := D3[grpsize-1];
D4Value := D4[grpsize-1];
{
C4 = sqrt(2.0 / (double(grpsize)-1));
double gamma = exp(gammln(double(grpsize)/2.0));
C4 *= gamma;
gamma = exp(gammln(double(grpsize-1)/2.0));
C4 /= gamma;
}
UCL := D4Value * GrandRange;
LCL := D3Value * GrandRange;
seMean := seMean - grandMean * grandMean / NoCases;
seMean := seMean / (NoCases - 1);
seMean := sqrt(seMean);
GrandSD := seMean;
seMean := seMean / sqrt(NoCases);
grandMean := grandMean / NoCases;
grandRange := grandRange / numGrps;
D3Value := D3[grpSize-1];
D4Value := D4[grpSize-1];
UCL := D4Value * grandRange;
LCL := D3Value * grandRange;
// print results
lReport := TStringList.Create;
try
lReport.Add('Range Chart Results');
lReport.Add('');
lReport.Add('Group Size Mean Ranges Std.Dev.');
lReport.Add('----- ---- -------- -------- --------');
lReport.Add(' Group Size Mean Std.Dev. Ranges ');
lReport.Add('------- ---- -------- -------- --------');
for i := 0 to numGrps-1 do
lReport.Add('%5d %4d %8.2f %8.2f %8.2f', [i+1, count[i], means[i], ranges[i], stddev[i]]);
lReport.Add('%7d %4d %8.2f %8.2f %8.2f', [i+1, count[i], means[i], stddev[i], ranges[i]]);
lReport.Add('');
lReport.Add('Grand Mean: %8.3f', [GrandMean]);
lReport.Add('Standard Deviation: %8.3f', [GrandSD]);
@ -235,287 +144,23 @@ begin
lReport.Add('Lower Control Limit: %8.3f', [LCL]);
lReport.Add('Upper Control Limit: %8.3f', [UCL]);
{$IFDEF USE_TACHART}
ReportMemo.Lines.Assign(lReport);
{$ELSE}
DisplayReport(lReport);
{$ENDIF}
finally
lReport.Free;
end;
// show graph
PlotMeans(groups, ranges, UCL, LCL, GrandRange);
// Clean up
groups := nil;
ranges := nil;
stddev := nil;
count := nil;
means := nil;
end;
procedure TRChartFrm.FormActivate(Sender: TObject);
var
w: Integer;
begin
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;
SpecsPanel.Constraints.MinWidth := Max(
VarListLabel.Width + MeasLabel.Width,
CloseBtn.Left + CloseBtn.Width - HelpBtn.Left + HelpBtn.BorderSpacing.Left
// show graph
PlotMeans(
Format('Range Chart for "%s"', [GetFileName]),
GroupEdit.Text, Format('Range(%s)', [MeasEdit.Text]),
'Group ranges', 'Mean range',
groups, ranges,
UCL, LCL, grandRange,
NaN, NaN, NaN
);
Constraints.MinHeight := MeasEdit.Top + MeasEdit.Height + ButtonBevel.Height + ButtonPanel.Height + 2*ButtonPanel.BorderSpacing.Bottom;
end;
procedure TRChartFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
{$IFDEF USE_TACHART}
FChartFrame := TChartFrame.Create(self);
FChartFrame.Parent := ChartPage;
FChartFrame.Align := alClient;
FChartFrame.BorderSpacing.Around := Scale96ToFont(8);
FChartFrame.Chart.Legend.SymbolWidth := Scale96ToFont(30);
FChartFrame.Chart.Legend.Alignment := laBottomCenter;
FChartFrame.Chart.Legend.ColumnCount := 3;
with FChartFrame.Chart.AxisList.Add do
begin
Alignment := calRight;
Marks.Source := TListChartSource.Create(self);
Marks.Style := smsLabel;
end;
{$ELSE}
if BlankFrm = nil then
Application.CreateForm(TBlankFrm, BlankFrm);
{$ENDIF}
end;
procedure TRChartFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TRChartFrm.HelpBtnClick(Sender: TObject);
begin
if ContextHelpForm = nil then
Application.CreateForm(TContextHelpForm, ContextHelpForm);
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TRChartFrm.PlotMeans(const Groups: StrDyneVec; const Means: DblDyneVec;
UCL, LCL, GrandMean: double);
const
CL_COLOR = clRed;
CL_STYLE = psDash;
var
fn: String;
{$IFDEF USE_TACHART}
rightLabels: TListChartSource;
ser: TChartSeries;
{$ELSE}
i, xpos, ypos, hleft, hright, vtop, vbottom, imagewide, NoGrps: integer;
vhi, hwide, offset, strhi: integer;
imagehi, maxval, minval, valincr, Yvalue: double;
Title: string;
{$ENDIF}
begin
fn := ExtractFileName(OS3MainFrm.FileNameEdit.Text);
{$IFDEF USE_TACHART}
rightLabels := FChartFrame.Chart.AxisList[2].Marks.Source as TListChartSource;
FChartFrame.Clear;
FChartFrame.SetTitle(Format('Range chart for "%s"', [fn]));
FChartFrame.SetXTitle(GroupEdit.Text);
FChartFrame.SetYTitle('Ranges of ' + MeasEdit.Text);
ser := FChartFrame.PlotXY(ptSymbols, nil, Means, Groups, nil, 'Group ranges', clBlack);
FChartFrame.Chart.BottomAxis.Marks.Source := ser.Source;
FChartFrame.Chart.BottomAxis.Marks.style := smsLabel;
FChartFrame.HorLine(GrandMean, clRed, psSolid, 'Mean range');
rightLabels.Add(GrandMean, GrandMean, 'Mean range');
FChartFrame.HorLine(UCL, CL_COLOR, CL_STYLE, 'UCL/LCL');
rightLabels.Add(UCL, UCL, 'UCL');
FChartFrame.HorLine(LCL, CL_COLOR, CL_STYLE, '');
rightLabels.Add(UCL, LCL, 'LCL');
{$ELSE}
NoGrps := Length(Groups);
maxval := -10000.0;
minval := 10000.0;
for i := 0 to NoGrps-1 do
begin
if means[i] > maxval then maxval := means[i];
if means[i] < minval then minval := means[i];
end;
if UCL > maxval then maxval := UCL;
if LCL < minval then minval := LCL;
BlankFrm.Show;
BlankFrm.Caption := 'RANGE CHART FOR ' + fn;
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;
BlankFrm.Image1.Canvas.FillRect(0, 0, BlankFrm.Image1.Width, BlankFrm.Image1.Height);
// Draw chart border
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
BlankFrm.Image1.Canvas.Rectangle(hleft,vtop-10,hleft+hwide,vtop+vhi+10);
// 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 := clRed;
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 horizontal axis
BlankFrm.Image1.Canvas.MoveTo(hleft,vbottom + 20);
BlankFrm.Image1.Canvas.LineTo(hright,vbottom + 20);
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;
BlankFrm.Image1.Canvas.TextOut(xpos,ypos,Title);
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('%8.2f',[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[0]) / (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-1]) / (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);
{$ENDIF}
end;
procedure TRChartFrm.ResetBtnClick(Sender: TObject);
var
i: integer;
begin
VarList.Clear;
GroupEdit.Text := '';
MeasEdit.Text := '';
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
{$IFDEF USE_TACHART}
FChartFrame.Clear;
{$ENDIF}
end;
procedure TRChartFrm.tbPrintClick(Sender: TObject);
begin
{$IFDEF USE_TACHART}
FChartFrame.Print;
{$ENDIF}
end;
procedure TRChartFrm.tbSaveClick(Sender: TObject);
begin
{$IFDEF USE_TACHART}
FChartFrame.Save;
{$ENDIF}
end;
procedure TRChartFrm.VarListClick(Sender: TObject);
var
index: integer;
begin
index := VarList.ItemIndex;
if index > -1 then
begin
if GroupEdit.Text = '' then
GroupEdit.Text := VarList.Items[index]
else
MeasEdit.Text := VarList.Items[index];
VarList.Items.Delete(index);
end;
end;
end.

View File

@ -1,16 +1,5 @@
inherited SChartForm: TSChartForm
HelpType = htKeyword
HelpKeyword = 'html/SControlChart.htm'
Caption = 'Sigma Chart'
inherited PageControl1: TPageControl
inherited ReportPage: TTabSheet
inherited Panel1: TPanel
inherited ReportMemo: TMemo
Left = 4
Height = 374
Top = 4
Width = 521
BorderSpacing.Around = 4
end
end
end
end
end

View File

@ -13,13 +13,8 @@ type
{ TSChartForm }
TSChartForm = class(TBasicSPCForm)
private
protected
procedure Compute; override;
public
end;
var
@ -67,8 +62,8 @@ begin
ColNoSelected[0] := GrpVar;
ColNoSelected[1] := MeasVar;
grpsize := 0;
oldgrpsize := 0;
grpSize := 0;
oldGrpSize := 0;
groups := GetGroups;
numGrps := Length(groups);
@ -166,7 +161,7 @@ begin
Format('Sigma Chart for "%s"', [GetFileName]),
GroupEdit.Text, Format('StdDev(%s)', [MeasEdit.Text]),
'Group Sigma', 'Mean',
groups, stdDev, nil,
groups, stdDev,
UCL, LCL, grandSigma,
NaN, NaN, NaN
);

View File

@ -0,0 +1,222 @@
inherited XBarChartForm: TXBarChartForm
Left = 572
Top = 215
HelpType = htKeyword
HelpKeyword = 'html/XBarChart.htm'
Caption = 'X-Bar Chart'
OnActivate = FormActivate
inherited SpecsPanel: TPanel
Width = 475
BorderSpacing.Right = 3
ClientWidth = 475
inherited ButtonPanel: TPanel
Width = 475
ClientWidth = 475
inherited CloseBtn: TButton
Left = 420
end
inherited ComputeBtn: TButton
Left = 336
end
inherited ResetBtn: TButton
Left = 274
end
inherited HelpBtn: TButton
Left = 223
end
inherited Bevel1: TBevel
Width = 467
end
end
inherited VarList: TListBox
Width = 233
end
inherited GroupLabel: TLabel
Left = 249
end
inherited GroupEdit: TEdit
Left = 249
Width = 226
end
inherited MeasLabel: TLabel
Left = 249
end
inherited MeasEdit: TEdit
AnchorSideRight.Control = LevelOptns
Left = 249
Width = 226
end
inherited Bevel2: TBevel
Left = 226
end
object SigmaOpts: TRadioGroup[8]
AnchorSideLeft.Control = MeasEdit
AnchorSideTop.Control = MeasEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = LevelOptns
AnchorSideRight.Side = asrBottom
Left = 249
Height = 128
Top = 108
Width = 226
Anchors = [akTop, akLeft, akRight]
AutoFill = True
BorderSpacing.Top = 12
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 = 222
ItemIndex = 0
Items.Strings = (
'3 Sigma (default)'
'2 Sigma'
'1 Sigma'
'x Sigmas with x = '
)
TabOrder = 4
object XSigmaEdit: TEdit
AnchorSideRight.Control = SigmaOpts
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 128
Height = 23
Top = 80
Width = 82
Alignment = taRightJustify
Anchors = [akLeft, akRight, akBottom]
TabOrder = 0
Text = 'XSigmaEdit'
end
end
object LevelOptns: TGroupBox[9]
AnchorSideLeft.Control = MeasEdit
AnchorSideTop.Control = SigmaOpts
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = MeasEdit
AnchorSideRight.Side = asrBottom
Left = 249
Height = 103
Top = 248
Width = 226
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 12
BorderSpacing.Bottom = 8
Caption = 'Show...'
ClientHeight = 83
ClientWidth = 222
TabOrder = 5
object UpperSpecChk: TCheckBox
AnchorSideLeft.Control = LevelOptns
AnchorSideTop.Control = UpperSpecEdit
AnchorSideTop.Side = asrCenter
Left = 12
Height = 19
Top = 2
Width = 116
BorderSpacing.Left = 12
Caption = 'Upper Spec. Level:'
TabOrder = 0
end
object LowerSpecChk: TCheckBox
AnchorSideLeft.Control = LevelOptns
AnchorSideTop.Control = LowerSpecEdit
AnchorSideTop.Side = asrCenter
Left = 12
Height = 19
Top = 29
Width = 113
BorderSpacing.Left = 12
Caption = 'Lower Spec. Level'
TabOrder = 2
end
object TargetChk: TCheckBox
AnchorSideLeft.Control = LevelOptns
AnchorSideTop.Control = TargetSpecEdit
AnchorSideTop.Side = asrCenter
Left = 12
Height = 19
Top = 56
Width = 124
BorderSpacing.Left = 12
BorderSpacing.Bottom = 8
Caption = 'Target Specification'
TabOrder = 4
end
object UpperSpecEdit: TEdit
AnchorSideLeft.Control = TargetSpecEdit
AnchorSideTop.Control = LevelOptns
AnchorSideRight.Control = TargetSpecEdit
AnchorSideRight.Side = asrBottom
Left = 144
Height = 23
Top = 0
Width = 63
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
TabOrder = 1
Text = 'UpperSpecEdit'
end
object LowerSpecEdit: TEdit
AnchorSideLeft.Control = TargetSpecEdit
AnchorSideTop.Control = UpperSpecEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = TargetSpecEdit
AnchorSideRight.Side = asrBottom
Left = 144
Height = 23
Top = 27
Width = 63
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
TabOrder = 3
Text = 'LowerSpecEdit'
end
object TargetSpecEdit: TEdit
AnchorSideLeft.Control = TargetChk
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = LowerSpecEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = LevelOptns
AnchorSideRight.Side = asrBottom
Left = 144
Height = 23
Top = 54
Width = 63
Alignment = taRightJustify
BorderSpacing.Left = 8
BorderSpacing.Top = 4
BorderSpacing.Right = 8
BorderSpacing.Bottom = 4
TabOrder = 5
Text = 'TargetSpecEdit'
end
end
end
inherited SpecsSplitter: TSplitter
Left = 478
end
inherited PageControl1: TPageControl
Left = 486
Width = 435
BorderSpacing.Left = 3
inherited ReportPage: TTabSheet
ClientWidth = 427
inherited Panel1: TPanel
Width = 415
ClientWidth = 411
inherited ReportMemo: TMemo
Width = 403
end
end
end
end
end

View File

@ -0,0 +1,289 @@
unit XBarChartUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls,
ExtCtrls, StdCtrls, BasicSPCUnit;
type
{ TXBarChartForm }
TXBarChartForm = class(TBasicSPCForm)
LevelOptns: TGroupBox;
LowerSpecChk: TCheckBox;
LowerSpecEdit: TEdit;
SigmaOpts: TRadioGroup;
TargetChk: TCheckBox;
TargetSpecEdit: TEdit;
UpperSpecChk: TCheckBox;
UpperSpecEdit: TEdit;
XSigmaEdit: TEdit;
procedure FormActivate(Sender: TObject);
protected
procedure Compute; override;
procedure Reset; override;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
end;
var
XBarChartForm: TXBarChartForm;
implementation
uses
Math,
Globals, Utils, MainUnit, DataProcs;
{$R *.lfm}
procedure TXBarChartForm.FormActivate(Sender: TObject);
var
w: Integer;
begin
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;
DisableAutoSizing;
try
LevelOptns.AnchorSideRight.Control := nil;
VarList.Constraints.MinWidth := VarListLabel.Width;
SpecsPanel.Constraints.MinWidth := Max(
CloseBtn.Left + CloseBtn.Width - HelpBtn.Left + HelpBtn.BorderSpacing.Around,
LevelOptns.Width * 2 + VarList.BorderSpacing.Right + VarList.BorderSpacing.Left
);
Constraints.MinHeight := LevelOptns.Top + LevelOptns.Height + LevelOptns.BorderSpacing.Bottom + ButtonPanel.Height;
LevelOptns.AnchorSideRight.Control := MeasEdit;
LevelOptns.AnchorSideRight.Side := asrBottom;
finally
EnableAutoSizing;
end;
end;
procedure TXBarChartForm.Compute;
var
i, j: Integer;
upperSpec, lowerSpec, targetSpec, sigma: Double;
ColNoSelected: IntDyneVec = nil;
groups: StrDyneVec = nil;
means: DblDyneVec = nil;
stdDev: DblDyneVec = nil;
count: IntDyneVec = nil;
numGrps: Integer;
grp: String;
grpIndex: Integer;
X, Xsq: Double;
UCL, LCL, grandMean, grandSD, seMean: Double;
lReport: TStrings;
begin
SetLength(ColNoSelected, 2);
ColNoSelected[0] := GrpVar;
ColNoSelected[1] := MeasVar;
if UpperSpecChk.Checked and (UpperSpecEdit.Text <> '') then
upperSpec := StrToFloat(UpperSpecEdit.Text)
else
upperSpec := NaN;
if LowerSpecChk.Checked and (LowerSpecEdit.Text <> '') then
lowerSpec := StrToFloat(LowerSpecEdit.Text)
else
lowerSpec := NaN;
if TargetChk.Checked and (TargetSpecEdit.Text <> '') then
targetSpec := StrToFloat(TargetSpecEdit.Text)
else
targetSpec := Nan;
case SigmaOpts.ItemIndex of
0: sigma := 3.0;
1: sigma := 2.0;
2: sigma := 1.0;
3: sigma := StrToFloat(XSigmaEdit.Text);
end;
groups := GetGroups;
numGrps := Length(groups);
SetLength(means, numGrps);
SetLength(count, numGrps);
SetLength(stddev, numGrps);
seMean := 0.0;
grandMean := 0.0;
// calculate group means, grand mean, group sd's, semeans
for i := 1 to NoCases do
begin
if not GoodRecord(i, Length(ColNoSelected), ColNoSelected) then continue;
grp := Trim(OS3MainFrm.DataGrid.Cells[GrpVar, i]);
grpIndex := IndexOfString(groups, grp);
X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[MeasVar, i]));
Xsq := X*X;
inc(count[grpIndex]);
means[grpIndex] := means[grpIndex] + X;
stddev[grpIndex] := stddev[grpIndex] + Xsq;
seMean := seMean + Xsq;
grandMean := grandMean + X;
end;
for i := 0 to numGrps-1 do
begin
if count[i] = 0 then
begin
means[i] := NaN;
stddev[i] := NaN;
end else
begin
if count[i] = 1 then
stddev[i] := NaN
else
begin
stddev[i] := stddev[i] - sqr(means[i]) / count[i];
stddev[i] := stddev[i] / (count[i] - 1);
stddev[i] := sqrt(stddev[i]);
end;
means[i] := means[i] / count[i];
end;
end;
seMean := seMean - sqr(grandMean) / NoCases;
seMean := sqrt(seMean / (NoCases - 1));
grandSD := seMean;
seMean := seMean / sqrt(NoCases);
grandMean := grandMean / NoCases;
UCL := grandMean + sigma * seMean;
LCL := grandMean - sigma * seMean;
// printed results
lReport := TStringList.Create;
try
lReport.Add('X BAR CHART RESULTS');
lReport.Add('');
lReport.Add(' Group Size Mean Std.Dev.');
lReport.Add('------- ---- -------- --------');
for i := 0 to numGrps-1 do
lReport.Add('%7s %4d %8.2f %8.2f', [groups[i], count[i], means[i], stddev[i]]);
lReport.Add('');
lReport.Add('Grand Mean: %8.3f', [grandMean]);
lReport.Add('Standard Deviation: %8.3f', [grandSD]);
lReport.Add('Standard Error of Mean: %8.3f', [seMean]);
lReport.Add('');
lReport.Add('Lower Control Limit: %8.3f', [LCL]);
lReport.Add('Upper Control Limit: %8.3f', [UCL]);
ReportMemo.Lines.Assign(lReport);
finally
lReport.Free;
end;
// show graph
PlotMeans(
Format('x&#772; chart for "%s"', [GetFileName]),
GroupEdit.Text, MeasEdit.Text, 'Group means', 'Grand mean',
groups, means,
UCL, LCL, grandmean,
targetSpec, lowerSpec, upperSpec
);
end;
procedure TXBarChartForm.Reset;
begin
inherited;
UpperSpecEdit.Text := '';
LowerSpecEdit.Text := '';
TargetSpecEdit.Text := '';
XSigmaEdit.Text := '';
UpperSpecChk.Checked := false;
LowerSpecChk.Checked := false;
TargetChk.Checked := false;
end;
function TXBarChartForm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
var
x: Double;
begin
Result := inherited;
if not Result then
exit;
Result := false;
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
begin
if (XSigmaEdit.Text = '') then
begin
AMsg := 'User-defined sigma units missing.';
AControl := XSigmaEdit;
exit;
end;
if not TryStrToFloat(XSigmaEdit.Text, x) then
begin
AMsg := 'No valid number given for sser-defined sigma units.';
AControl := XSigmaEdit;
exit;
end;
end;
if UpperSpecChk.Checked then begin
if UpperSpecEdit.Text = '' then
begin
AMsg := 'Upper Spec Level missing.';
AControl := UpperSpecEdit;
exit;
end;
if not TryStrToFloat(UpperSpecEdit.Text, x) then
begin
AMsg := 'Upper Spec Level is not a valid number.';
AControl := UpperSpecEdit;
exit;
end;
end;
if LowerSpecChk.Checked then begin
if LowerSpecEdit.Text = '' then
begin
AMsg := 'Lower Spec Level missing.';
AControl := LowerSpecEdit;
exit;
end;
if not TryStrToFloat(LowerSpecEdit.Text, x) then
begin
AMsg := 'Lower Spec Level is not a valid number.';
AControl := LowerSpecEdit;
exit;
end;
end;
if TargetChk.Checked then begin
if TargetSpecEdit.Text = '' then
begin
AMsg := 'Target Spec Level missing.';
AControl := TargetSpecEdit;
exit;
end;
if not TryStrToFloat(TargetSpecEdit.Text, x) then
begin
AMsg := 'Target Spec Level is not a valid number.';
AControl := TargetSpecEdit;
exit;
end;
end;
Result := true;
end;
end.

View File

@ -1,449 +0,0 @@
object XBarFrm: TXBarFrm
Left = 591
Height = 426
Top = 279
Width = 1000
HelpType = htKeyword
HelpKeyword = 'html/XBarChart.htm'
Caption = 'X Bar Chart'
ClientHeight = 426
ClientWidth = 1000
OnActivate = FormActivate
OnCreate = FormCreate
OnShow = FormShow
Position = poMainFormCenter
LCLVersion = '2.1.0.0'
object SpecsPanel: TPanel
Left = 0
Height = 426
Top = 0
Width = 433
Align = alLeft
BorderSpacing.Right = 2
BevelOuter = bvNone
ClientHeight = 426
ClientWidth = 433
TabOrder = 0
object VarListLabel: TLabel
AnchorSideLeft.Control = SpecsPanel
AnchorSideTop.Control = SpecsPanel
Left = 8
Height = 15
Top = 8
Width = 97
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Selection Variables'
ParentColor = False
end
object VarList: TListBox
AnchorSideLeft.Control = SpecsPanel
AnchorSideTop.Control = VarListLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SigmaOpts
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 352
Top = 25
Width = 198
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0
OnClick = VarListClick
TabOrder = 0
end
object SigmaOpts: TRadioGroup
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GroupBox1
AnchorSideRight.Side = asrBottom
Left = 214
Height = 128
Top = 108
Width = 219
Anchors = [akTop, akLeft, akRight]
AutoFill = True
BorderSpacing.Top = 12
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 = 215
ItemIndex = 0
Items.Strings = (
'3 Sigma (default)'
'2 Sigma'
'1 Sigma'
'x Sigmas with x = '
)
TabOrder = 1
object XSigmaEdit: TEdit
AnchorSideRight.Control = SigmaOpts
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 144
Height = 23
Top = 80
Width = 59
Alignment = taRightJustify
Anchors = [akLeft, akRight, akBottom]
TabOrder = 0
Text = 'XSigmaEdit'
end
end
object GroupBox1: TGroupBox
AnchorSideTop.Control = SigmaOpts
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SpecsPanel
AnchorSideRight.Side = asrBottom
Left = 214
Height = 126
Top = 248
Width = 219
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Top = 12
Caption = 'Show...'
ClientHeight = 106
ClientWidth = 215
TabOrder = 2
object UpSpecChk: TCheckBox
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = UpSpecEdit
AnchorSideTop.Side = asrCenter
Left = 12
Height = 19
Top = 2
Width = 116
BorderSpacing.Left = 12
Caption = 'Upper Spec. Level:'
TabOrder = 0
end
object LowSpecChk: TCheckBox
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = LowSpecEdit
AnchorSideTop.Side = asrCenter
Left = 12
Height = 19
Top = 29
Width = 113
BorderSpacing.Left = 12
Caption = 'Lower Spec. Level'
TabOrder = 2
end
object TargetChk: TCheckBox
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = TargetSpecEdit
AnchorSideTop.Side = asrCenter
Left = 12
Height = 19
Top = 56
Width = 124
BorderSpacing.Left = 12
BorderSpacing.Bottom = 6
Caption = 'Target Specification'
TabOrder = 4
end
object UpSpecEdit: TEdit
AnchorSideLeft.Control = TargetSpecEdit
AnchorSideTop.Control = GroupBox1
AnchorSideRight.Control = TargetSpecEdit
AnchorSideRight.Side = asrBottom
Left = 144
Height = 23
Top = 0
Width = 63
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
TabOrder = 1
Text = 'UpSpecEdit'
end
object LowSpecEdit: TEdit
AnchorSideLeft.Control = TargetSpecEdit
AnchorSideTop.Control = UpSpecEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = TargetSpecEdit
AnchorSideRight.Side = asrBottom
Left = 144
Height = 23
Top = 27
Width = 63
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
TabOrder = 3
Text = 'Edit1'
end
object TargetSpecEdit: TEdit
AnchorSideLeft.Control = TargetChk
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = LowSpecEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GroupBox1
AnchorSideRight.Side = asrBottom
Left = 144
Height = 23
Top = 54
Width = 63
Alignment = taRightJustify
BorderSpacing.Left = 8
BorderSpacing.Top = 4
BorderSpacing.Right = 8
TabOrder = 5
Text = 'Edit1'
end
object ErrorBarsChk: TCheckBox
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = TargetSpecEdit
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Top = 81
Width = 70
BorderSpacing.Left = 12
BorderSpacing.Top = 4
BorderSpacing.Bottom = 6
Caption = 'Error Bars'
TabOrder = 6
end
end
object Panel1: TPanel
AnchorSideLeft.Control = GroupBox1
AnchorSideRight.Control = GroupBox1
AnchorSideRight.Side = asrBottom
Left = 214
Height = 88
Top = 8
Width = 219
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 8
BevelOuter = bvNone
ClientHeight = 88
ClientWidth = 219
TabOrder = 3
object Label2: TLabel
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
Left = 0
Height = 15
Top = 0
Width = 105
BorderSpacing.Bottom = 2
Caption = 'Group (Lot) Variable'
ParentColor = False
end
object Label3: TLabel
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = GroupEdit
AnchorSideTop.Side = asrBottom
Left = 0
Height = 15
Top = 48
Width = 117
BorderSpacing.Bottom = 2
Caption = 'Measurement Variable'
ParentColor = False
end
object GroupEdit: TEdit
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
Left = 0
Height = 23
Top = 17
Width = 219
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2
BorderSpacing.Bottom = 8
ReadOnly = True
TabOrder = 0
Text = 'GroupEdit'
end
object MeasEdit: TEdit
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
Left = 0
Height = 23
Top = 65
Width = 219
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2
ReadOnly = True
TabOrder = 1
Text = 'MeasEdit'
end
end
object Bevel1: TBevel
AnchorSideLeft.Control = SpecsPanel
AnchorSideRight.Control = SpecsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 377
Width = 433
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object ResetBtn: TButton
AnchorSideTop.Control = CloseBtn
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Side = asrBottom
Left = 232
Height = 25
Top = 393
Width = 54
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 4
end
object ComputeBtn: TButton
AnchorSideTop.Control = CloseBtn
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Side = asrBottom
Left = 294
Height = 25
Top = 393
Width = 76
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 5
end
object CloseBtn: TButton
AnchorSideRight.Control = SpecsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 378
Height = 25
Top = 393
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
TabOrder = 6
end
object HelpBtn: TButton
Tag = 159
AnchorSideTop.Control = CloseBtn
AnchorSideRight.Control = ResetBtn
AnchorSideBottom.Side = asrBottom
Left = 173
Height = 25
Top = 393
Width = 51
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 7
end
end
object Splitter1: TSplitter
Left = 435
Height = 426
Top = 0
Width = 5
ResizeStyle = rsPattern
end
object PageControl: TPageControl
Left = 442
Height = 414
Top = 6
Width = 552
ActivePage = ChartPage
Align = alClient
BorderSpacing.Left = 2
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
TabIndex = 1
TabOrder = 2
object ReportPage: TTabSheet
Caption = 'Report'
ClientHeight = 386
ClientWidth = 544
object ReportMemo: TMemo
Left = 6
Height = 374
Top = 6
Width = 532
Align = alClient
BorderSpacing.Around = 6
Font.CharSet = ANSI_CHARSET
Font.Height = -11
Font.Name = 'Courier New'
Font.Pitch = fpFixed
Font.Quality = fqDraft
ParentFont = False
TabOrder = 0
end
end
object ChartPage: TTabSheet
Caption = 'Chart'
ClientHeight = 386
ClientWidth = 544
object ToolBar1: TToolBar
Left = 514
Height = 374
Top = 6
Width = 24
Align = alRight
AutoSize = True
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
Caption = 'ToolBar1'
EdgeBorders = []
Images = MainDataModule.ImageList
TabOrder = 0
Transparent = True
object tbSave: TToolButton
Left = 1
Hint = 'Save chart to file'
Top = 0
Caption = 'tbSave'
ImageIndex = 4
OnClick = tbSaveClick
end
object tbPrint: TToolButton
Left = 1
Hint = 'Print chart'
Top = 22
Caption = 'tbPrint'
ImageIndex = 5
OnClick = tbPrintClick
end
end
end
end
end

View File

@ -1,674 +0,0 @@
// Use file "boltsize.laz" for testing
// Group Variable --> LotNo
// Selected Variable --> BoltLength
// Upper Spec Level --> 20.05
// Lower Spec Level --> 19.95
// Target Spec --> 20.00
unit XBarUnit;
{$mode objfpc}{$H+}
{$include ../../../LazStats.inc}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Buttons, ComCtrls,
MainUnit, Globals, ContextHelpUnit, DataProcs, GraphLib,
{$IFDEF USE_TACHART}
TAChartUtils, TASources, TACustomSeries, TASeries, TALegend, TAChartAxisUtils,
ChartFrameUnit;
{$ELSE}
OutputUnit, BlankFrmUnit;
{$ENDIF}
type
{ TXBarFrm }
TXBarFrm = class(TForm)
Bevel1: TBevel;
ErrorBarsChk: TCheckBox;
HelpBtn: TButton;
ReportMemo: TMemo;
PageControl: TPageControl;
Panel1: TPanel;
SpecsPanel: TPanel;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
Splitter1: TSplitter;
ReportPage: TTabSheet;
ChartPage: TTabSheet;
tbPrint: TToolButton;
tbSave: TToolButton;
ToolBar1: TToolBar;
UpSpecEdit: TEdit;
LowSpecEdit: TEdit;
TargetSpecEdit: TEdit;
UpSpecChk: TCheckBox;
LowSpecChk: TCheckBox;
TargetChk: TCheckBox;
GroupBox1: TGroupBox;
XSigmaEdit: TEdit;
GroupEdit: TEdit;
MeasEdit: TEdit;
VarListLabel: TLabel;
Label2: TLabel;
Label3: TLabel;
SigmaOpts: TRadioGroup;
VarList: TListBox;
procedure ComputeBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure tbPrintClick(Sender: TObject);
procedure tbSaveClick(Sender: TObject);
procedure VarListClick(Sender: TObject);
private
{ private declarations }
{$IFDEF USE_TACHART}
FChartFrame: TChartFrame;
{$ENDIF}
// FAutoSized: Boolean;
procedure PlotMeans(const Groups: StrDyneVec; const Means, StdDevs: DblDyneVec;
UCL, LCL, GrandMean, TargetSpec, LowerSpec, UpperSpec: double);
function Validate(out AMsg: String; out AControl: TWinControl): Boolean;
public
{ public declarations }
end;
var
XBarFrm: TXBarFrm;
implementation
uses
Math,
Utils;
{ TXBarFrm }
procedure TXBarFrm.ResetBtnClick(Sender: TObject);
var
i : integer;
begin
VarList.Clear;
GroupEdit.Text := '';
MeasEdit.Text := '';
UpSpecEdit.Text := '';
LowSpecEdit.Text := '';
TargetSpecEdit.Text := '';
XSigmaEdit.Text := '';
UpSpecChk.Checked := false;
LowSpecChk.Checked := false;
TargetChk.Checked := false;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
{$IFDEF USE_TACHART}
FChartFrame.Clear;
{$ENDIF}
end;
procedure TXBarFrm.tbPrintClick(Sender: TObject);
begin
FChartFrame.Print;
end;
procedure TXBarFrm.tbSaveClick(Sender: TObject);
begin
FChartFrame.Save;
end;
procedure TXBarFrm.VarListClick(Sender: TObject);
var
index: integer;
begin
index := VarList.ItemIndex;
if index > -1 then
begin
if GroupEdit.Text = '' then
GroupEdit.Text := VarList.Items[index]
else
MeasEdit.Text := VarList.Items[index];
VarList.Items.Delete(index);
end;
end;
procedure TXBarFrm.HelpBtnClick(Sender: TObject);
begin
if ContextHelpForm = nil then
Application.CreateForm(TContextHelpForm, ContextHelpForm);
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TXBarFrm.ComputeBtnClick(Sender: TObject);
var
i, GrpVar, MeasVar, grpIndex: integer;
X, UCL, LCL, Sigma, UpperSpec, LowerSpec, TargetSpec: double;
GrandMean, GrandSD, semean: double;
grp: String;
numGrps: Integer;
groups: StrDyneVec = nil;
means: DblDyneVec = nil;
stddev: DblDyneVec = nil;
count: IntDyneVec = nil;
cellstring: string;
ColNoSelected: IntDyneVec = nil;
NoSelected: integer;
msg: String;
C: TWinControl;
lReport: TStrings;
begin
if not Validate(msg, C) then begin
C.SetFocus;
MessageDlg(msg, mtError, [mbOK], 0);
exit;
end;
SetLength(ColNoSelected, NoVariables);
GrpVar := 1;
MeasVar := 2;
Sigma := 3.0;
UpperSpec := 0.0;
LowerSpec := 0.0;
TargetSpec := 0.0;
for i := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
if cellstring = GroupEdit.Text then GrpVar := i;
if cellstring = MeasEdit.Text then MeasVar := i;
end;
ColNoSelected[0] := MeasVar;
ColNoSelected[1] := GrpVar;
NoSelected := 2;
if UpSpecEdit.Text <> '' then UpperSpec := StrToFloat(UpSpecEdit.Text);
if LowSpecEdit.Text <> '' then LowerSpec := StrToFloat(LowSpecEdit.Text);
if TargetSpecEdit.Text <> '' then TargetSpec := StrToFloat(TargetSpecEdit.Text);
case SigmaOpts.ItemIndex of
0: Sigma := 3.0;
1: Sigma := 2.0;
2: Sigma := 1.0;
3: Sigma := StrToFloat(XSigmaEdit.Text);
end;
numGrps := 0;
SetLength(groups, NoCases);
for i := 1 to NoCases do
begin
if not GoodRecord(i, NoSelected, ColNoSelected) then continue;
grp := Trim(OS3MainFrm.DataGrid.Cells[GrpVar, i]);
if IndexOfString(groups, grp) = -1 then
begin
groups[numGrps] := grp;
inc(numGrps);
end;
end;
SetLength(groups, numGrps);
SetLength(means, numGrps);
SetLength(count, numGrps);
SetLength(stddev, numGrps);
semean := 0.0;
GrandMean := 0.0;
// calculate group means, grand mean, group sd's, semeans
for i := 1 to NoCases do
begin
if not GoodRecord(i, NoSelected, ColNoSelected) then continue;
grp := Trim(OS3MainFrm.DataGrid.cells[GrpVar, i]);
grpIndex := IndexOfString(groups, grp);
X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[MeasVar, i]));
means[grpIndex] := means[grpIndex] + X;
count[grpIndex] := count[grpIndex] + 1;
stddev[grpIndex] := stddev[grpIndex] + sqr(X);
semean := semean + sqr(X);
GrandMean := GrandMean + X;
end;
for i := 0 to numGrps-1 do
begin
if count[i] = 0 then
begin
means[i] := NaN;
stddev[i] := NaN;
end else
begin
if count[i] = 1 then
stddev[i] := NaN
else
begin
stddev[i] := stddev[i] - sqr(means[i]) / count[i];
stddev[i] := stddev[i] / (count[i] - 1);
stddev[i] := sqrt(stddev[i]);
end;
means[i] := means[i] / count[i];
end;
end;
semean := semean - sqr(GrandMean) / NoCases;
semean := sqrt(semean / (NoCases - 1));
GrandSD := semean;
semean := semean / sqrt(NoCases);
GrandMean := GrandMean / NoCases;
UCL := GrandMean + Sigma * semean;
LCL := GrandMean - Sigma * semean;
// printed results
lReport := TStringList.Create;
try
lReport.Add('X BAR CHART RESULTS');
lReport.Add('');
lReport.Add('Group Size Mean Std.Dev.');
lReport.Add('----- ---- --------- ----------');
for i := 0 to numGrps-1 do
lReport.Add('%5s %4d %9.2f %9.2f', [groups[i], count[i], means[i], stddev[i]]);
lReport.Add('');
lReport.Add('Grand Mean: %8.3f', [GrandMean]);
lReport.Add('Standard Deviation: %8.3f', [GrandSD]);
lReport.Add('Standard Error of Mean: %8.3f', [semean]);
lReport.Add('');
lReport.Add('Lower Control Limit: %8.3f', [LCL]);
lReport.Add('Upper Control Limit: %8.3f', [UCL]);
{$IFDEF USE_TACHART}
ReportMemo.Lines.Assign(lReport);
{$ELSE}
DisplayReport(lReport);
{$ENDIF}
finally
lReport.Free;
end;
// show graph
{$IFNDEF USE_TACHART}
BlankFrm.Image1.Canvas.Clear;
BlankFrm.Show;
{$ENDIF}
if not ErrorBarsChk.Checked then stddev := nil;
PlotMeans(groups, means, stddev, UCL, LCL, GrandMean, TargetSpec, LowerSpec, UpperSpec);
// Clean up
stddev := nil;
count := nil;
means := nil;
groups := nil;
ColNoSelected := nil;
end;
procedure TXBarFrm.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.MinWidth := VarListLabel.Width;
SpecsPanel.Constraints.MinWidth := VarListLabel.Left + VarListLabel.Width + VarList.BorderSpacing.Right + GroupBox1.Width;
// VarList.Constraints.MinHeight := GroupBox1.Top + GroupBox1.Height - VarList.Top;
// SpecsPanel.Constraints.MinWidth := SpecsPanel.Width;
// PageControl.Constraints.MinWidth := SpecsPanel.Width ;
//AutoSize := false;
Constraints.MinHeight := GroupBox1.Top + GroupBox1.Height + Bevel1.Height + CloseBtn.Height + CloseBtn.BorderSpacing.Top * 2; // Height;
//Constraints.MinWidth := Width;
// FAutoSized := true;
end;
procedure TXBarFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
{$IFDEF USE_TACHART}
FChartFrame := TChartFrame.Create(self);
FChartFrame.Parent := ChartPage;
FChartFrame.Align := alClient;
FChartFrame.BorderSpacing.Around := Scale96ToFont(8);
FChartFrame.Chart.Legend.SymbolWidth := Scale96ToFont(30);
FChartFrame.Chart.Legend.Alignment := laBottomCenter;
FChartFrame.Chart.Legend.ColumnCount := 3;
FChartFrame.Chart.Title.TextFormat := tfHtml;
with FChartFrame.Chart.AxisList.Add do
begin
Alignment := calRight;
Marks.Source := TListChartSource.Create(self);
Marks.Style := smsLabel;
end;
{$ELSE}
if BlankFrm = nil then
Application.CreateForm(TBlankFrm, BlankFrm);
{$ENDIF}
end;
procedure TXBarFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TXBarFrm.PlotMeans(const Groups: StrDyneVec; const Means, StdDevs: DblDyneVec;
UCL, LCL, GrandMean, TargetSpec, LowerSpec, UpperSpec: double);
const
TARGET_COLOR = clBlue;
CL_COLOR = clRed;
SPEC_COLOR = clGreen;
CL_STYLE = psDash;
SPEC_STYLE = psSolid;
var
fn: String;
{$IFDEF USE_TACHART}
ser: TChartSeries;
rightLabels: TListChartSource;
constLine: TConstantLine;
s: String;
{$ELSE}
i: Integer;
xpos, ypos, hleft, hright, vtop, vbottom, imagewide: integer;
maxVal, minVal: Double;
NoGrps, vhi, hwide, offset, strhi: integer;
imagehi, valincr, Yvalue: double;
title: String;
{$ENDIF}
begin
fn := ExtractFileName(OS3MainFrm.FileNameEdit.Text);
{$IFDEF USE_TACHART}
rightLabels := FChartFrame.Chart.AxisList[2].Marks.Source as TListChartSource;
FChartFrame.Clear;
FChartFrame.SetTitle(Format('x&#772; chart for "%s"', [fn]));
FChartFrame.SetXTitle(GroupEdit.Text);
FChartFrame.SetYTitle(MeasEdit.Text);
ser := FChartFrame.PlotXY(ptSymbols, nil, Means, Groups, StdDevs, 'Group means', clBlack);
FChartFrame.Chart.BottomAxis.Marks.Source := ser.Source;
FChartFrame.Chart.BottomAxis.Marks.style := smsLabel;
FChartFrame.HorLine(GrandMean, clRed, psSolid, 'Grand mean');
rightLabels.Add(GrandMean, GrandMean, 'Grand mean');
FChartFrame.HorLine(UCL, CL_COLOR, CL_STYLE, 'UCL/LCL');
rightLabels.Add(UCL, UCL, 'UCL');
FChartFrame.HorLine(LCL, CL_COLOR, CL_STYLE, '');
rightLabels.Add(UCL, LCL, 'LCL');
if UpSpecChk.Checked then
begin
if LowSpecChk.Checked then
s := 'Upper/Lower Spec'
else
s := 'Upper Spec';
FChartFrame.HorLine(UpperSpec, SPEC_COLOR, SPEC_STYLE, s);
rightLabels.Add(UpperSpec, UpperSpec, 'Upper Spec');
end;
if TargetChk.Checked then begin
FChartFrame.HorLine(TargetSpec, TARGET_COLOR, psSolid, 'Target');
rightLabels.Add(TargetSpec, TargetSpec, 'Target');
end;
if LowSpecChk.Checked then
begin
if UpSpecChk.Checked then
s := 'Upper/Lower Spec'
else
s := 'Lower Spec';
constLine := FChartFrame.HorLine(LowerSpec, SPEC_COLOR, SPEC_STYLE, s);
constLine.Legend.Visible := not UpSpecChk.Checked;
rightLabels.Add(LowerSpec, LowerSpec, 'Lower Spec');
end;
{$ELSE}
NoGrps := Length(groups);
maxval := -Infinity;
minval := Infinity;
for i := 0 to NoGrps-1 do
begin
if means[i] > maxval then maxval := means[i];
if means[i] < minval then minval := means[i];
end;
if UCL > maxval then maxval := UCL;
if LCL < minval then minval := LCL;
if UpSpecChk.Checked and (UpperSpec > maxval) then maxval := UpperSpec;
if LowSpecChk.Checked and (LowerSpec < minval) then minval := LowerSpec;
if TargetChk.Checked then
begin
if TargetSpec > maxval then maxval := TargetSpec;
if TargetSpec < minval then minval := TargetSpec;
end;
BlankFrm.Caption := 'XBAR CHART FOR ' + fn;
imagewide := BlankFrm.Image1.Width;
imagehi := BlankFrm.Image1.Height;
vtop := 20;
vbottom := round(imagehi) - 80;
vhi := vbottom - vtop;
hleft := 100;
hright := imagewide - 100;
hwide := hright - hleft;
// Draw outer background
BlankFrm.Image1.Canvas.Brush.Color := clLtGray;
BlankFrm.Image1.Canvas.FillRect(0, 0, BlankFrm.Image1.Width, BlankFrm.Image1.Height);
// Draw chart border and inner background
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
BlankFrm.Image1.Canvas.Brush.Color := clWhite;
BlankFrm.Image1.Canvas.Rectangle(hleft,vtop-10,hleft+hwide,vtop+vhi+10);
// Draw Grand Mean
xpos := hright + 10;
ypos := round(vhi * ( (maxval - GrandMean) / (maxval - minval)));
ypos := ypos + vtop;
BlankFrm.Image1.Canvas.Pen.Color := clRed;
BlankFrm.Image1.Canvas.Line(hLeft, ypos, hright, ypos);
title := 'MEAN';
strhi := BlankFrm.Image1.Canvas.TextHeight(title);
BlankFrm.Image1.Canvas.Brush.Style := bsClear;
BlankFrm.Image1.Canvas.TextOut(xpos, ypos - strhi div 2, title);
// draw horizontal axis
//BlankFrm.Image1.Canvas.Line(hleft, vbottom + 20, hright, vbottom + 20);
BlankFrm.Image1.Canvas.Pen.Color := clBlack;
for i := 1 to NoGrps do
begin
ypos := vbottom + 10;
xpos := round(hwide / NoGrps * i + hleft);
BlankFrm.Image1.Canvas.Line(xpos, ypos, xpos, ypos + 10);
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.TextOut(xpos, ypos, title);
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('%.2f', [maxval - (i - 1) * valincr]);
strhi := BlankFrm.Image1.Canvas.TextHeight(title);
Yvalue := maxval - valincr * (i - 1);
ypos := vtop + round(vhi * (maxval - Yvalue) / (maxval - minval));
BlankFrm.Image1.Canvas.Line(hleft, ypos, hleft-10, ypos);
xpos := hleft - 20 - BlankFrm.Image1.Canvas.TextWidth(title);;
BlankFrm.Image1.Canvas.TextOut(xpos, ypos - strhi div 2, title);
end;
// draw lines for means of the groups
ypos := round(vhi * (maxval - means[0]) / (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-1]) / (maxval - minval));
ypos := ypos + vtop;
xpos := round(hwide/NoGrps* i + hleft);
BlankFrm.Image1.Canvas.LineTo(xpos, ypos);
end;
// Draw upper and lower confidence intervals
xpos := hright + 10;
ypos := round(vhi * (maxval - UCL) / (maxval - minval));
ypos := ypos + vtop;
BlankFrm.Image1.Canvas.Pen.Style := CL_STYLE;
BlankFrm.Image1.Canvas.Pen.Color := CL_COLOR;
BlankFrm.Image1.Canvas.Line(hleft, ypos, hright, 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;
BlankFrm.Image1.Canvas.Pen.Color := CL_COLOR;
BlankFrm.Image1.Canvas.Line(hleft, ypos, hright, ypos);
title := 'LCL';
strhi := BlankFrm.Image1.Canvas.TextHeight(title);
ypos := ypos - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos, ypos, title);
// Draw lines for specified values
if UpSpecChk.Checked then
begin
ypos := round(vhi * (maxval - UpperSpec) / (maxval - minval));
ypos := ypos + vtop;
BlankFrm.Image1.Canvas.Pen.Color := SPEC_COLOR;
BlankFrm.Image1.Canvas.Pen.Style := SPEC_STYLE;
BlankFrm.Image1.Canvas.Line(hleft, ypos, hright, ypos);
title := 'UPPER SPEC';
strhi := BlankFrm.Image1.Canvas.TextHeight(title);
ypos := ypos - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos, ypos, title);
end;
if LowSpecChk.Checked then
begin
ypos := round(vhi * (maxval - LowerSpec) / (maxval - minval));
ypos := ypos + vtop;
BlankFrm.Image1.Canvas.Pen.Color := SPEC_COLOR;
BlankFrm.Image1.Canvas.Line(hleft, ypos, hright, ypos);
title := 'LOWER SPEC';
strhi := BlankFrm.Image1.Canvas.TextHeight(title);
ypos := ypos - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos, ypos, title);
end;
if TargetChk.Checked then
begin
ypos := round(vhi * (maxval - TargetSpec) / (maxval - minval));
ypos := ypos + vtop;
BlankFrm.Image1.Canvas.Pen.Color := TARGET_COLOR;
BlankFrm.Image1.Canvas.Line(hleft, ypos, hright, ypos);
title := 'TARGET';
strhi := BlankFrm.Image1.Canvas.TextHeight(title);
ypos := ypos - strhi div 2;
BlankFrm.Image1.Canvas.TextOut(xpos, ypos, title);
end;
{$ENDIF}
end;
function TXBarFrm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
var
x: Double;
begin
Result := false;
if GroupEdit.Text = '' then begin
AMsg := 'Group variable not specified.';
AControl := GroupEdit;
exit;
end;
if MeasEdit.Text = '' then
begin
AMsg := 'Measurement variable not specified.';
AControl := MeasEdit;
exit;
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
begin
if (XSigmaEdit.Text = '') then
begin
AMsg := 'User-defined sigma units missing.';
AControl := XSigmaEdit;
exit;
end;
if not TryStrToFloat(XSigmaEdit.Text, x) then
begin
AMsg := 'No valid number given for sser-defined sigma units.';
AControl := XSigmaEdit;
exit;
end;
end;
if UpSpecChk.Checked then begin
if UpSpecEdit.Text = '' then
begin
AMsg := 'Upper Spec Level missing.';
AControl := UpSpecEdit;
exit;
end;
if not TryStrToFloat(UpSpecEdit.Text, x) then
begin
AMsg := 'Upper Spec Level is not a valid number.';
AControl := UpSpecEdit;
exit;
end;
end;
if LowSpecChk.Checked then begin
if LowSpecEdit.Text = '' then
begin
AMsg := 'Lower Spec Level missing.';
AControl := LowSpecEdit;
exit;
end;
if not TryStrToFloat(LowSpecEdit.Text, x) then
begin
AMsg := 'Lower Spec Level is not a valid number.';
AControl := LowSpecEdit;
exit;
end;
end;
if TargetChk.Checked then begin
if TargetSpecEdit.Text = '' then
begin
AMsg := 'Target Spec Level missing.';
AControl := TargetSpecEdit;
exit;
end;
if not TryStrToFloat(TargetSpecEdit.Text, x) then
begin
AMsg := 'Target Spec Level is not a valid number.';
AControl := TargetSpecEdit;
exit;
end;
end;
Result := true;
end;
initialization
{$I xbarunit.lrs}
end.

View File

@ -510,8 +510,8 @@ uses
BinomialUnit, KendallTauUnit, KaplanMeierUnit,
// Statistical process control
XBarUnit, RChartUnit, SChartUnit, CUMSUMUNIT, CCHARTUNIT,
PChartUnit, UChartUnit, //SigmaChartUnit,
XBarChartUnit, RChartUnit, SChartUnit, CUMSUMUNIT, CCHARTUNIT,
PChartUnit, UChartUnit,
CorSimUnit,
ErrorCurvesUnit, PCurvesUnit, DistribUnit, GenSeqUnit, GenRndValsUnit,
@ -2136,17 +2136,17 @@ end;
// Menu "Analysis" > "Statistical Process Control" > "XBAR Chart"
procedure TOS3MainFrm.mnuAnalysisSPC_XBarClick(Sender: TObject);
begin
if XBarFrm = nil then
Application.CreateForm(TXBarFrm, XBarFrm);
XBarFrm.ShowModal;
if XBarChartForm = nil then
Application.CreateForm(TXBarChartForm, XBarChartForm);
XBarChartForm.ShowModal;
end;
// Menu "Analysis" > "Statistical Process Control" > "Range Chart"
procedure TOS3MainFrm.mnuAnalysisSPC_RangeClick(Sender: TObject);
begin
if RChartFrm = nil then
Application.CreateForm(TRChartFrm, RChartFrm);
RChartFrm.ShowModal;
if RChartForm = nil then
Application.CreateForm(TRChartForm, RChartForm);
RChartForm.ShowModal;
end;
// Menu "Analysis" > "Statistical Process Control" > "S Control Chart"
@ -2155,11 +2155,6 @@ begin
if SChartForm = nil then
Application.CreateForm(TSChartForm, SChartForm);
SChartForm.ShowModal;
{
if SigmaChartFrm = nil then
Application.CreateForm(TSigmaChartFrm, SigmaChartFrm);
SigmaChartFrm.ShowModal;
}
end;
// Menu "Analysis" > "Statistical Process Control" > "Defect (nonconformity) c Chart"