'===========================================================================
' Subject: Control Limits Graph               Date: 10-01-01 (  :  )       
'  Author: Gerald L. Wykoff                   Code: QB, Qbasic, PDS        
'  Origin: wykoff@mbawiz.com                Packet: ALGOR.ABC
'===========================================================================
' Subject: Control Limits Graphic                 Date: 10-10-1  (18:22)   
'           Author: Gerald L. Wykoff                       Code: QB, QBasic
'           Origin:  wykoff@mbawiz.com
'
REM  Evaluating a series of data and imposing an Upper Control Limit and
REM  a Lower Control Limit is very useful for evaluating the acceptable
REM  consistency of production or sales performance.  This utility
REM  calculates and the plots on a graph the data for up to 20 entries.
CLS
SCREEN 9
COLOR 14, 8
DEFLNG A-Z
LINE (5, 5)-(630, 5), 12
LINE -(630, 338), 12
LINE -(5, 338), 12
LINE -(5, 5), 12
LINE (4, 4)-(631, 4), 3
LINE -(631, 339), 3
LINE -(4, 339), 3
LINE -(4, 4), 3
PRINT
PRINT
PRINT "            The graphic display ranges are optimized to"
PRINT "         accommodate numbers consisting of 1-digit or 3-digits"
PRINT "         (both types BEFORE any decimal."
PRINT "            This utility is an auxiliary graphic device to"
PRINT "         give you a grasp or quick impression of your data. For"
PRINT "         that reason - ease and quick results - data can only be"
PRINT "         entered from the keyboard. "
PRINT "            The graphic will trace a single list (sales volume,"
PRINT "         profits, dividends, etc. If this is a control limit,"
PRINT "         sampling or quality control type problem i.e., X number"
PRINT "         of defects per N hours of processing, or X number of de-"
PRINT "         fective boards per N cord deliveries, etc., then you'll be"
PRINT "         prompted for the total sample taken so the program, based"
PRINT "         on the range and volatilty of your entries, can also calcu-"
PRINT "         late and draw on the screen an Upper Control Limit and a"
PRINT "         Lower Control Limit (LCL) to warn of problems."
PRINT
COLOR 7
PRINT
PRINT "          Type in a title name for the graphics display"
INPUT "               that you'll be creating "; namer$
PRINT
COLOR 15
PRINT "               To Continue, Tap Any Key"
DO WHILE INKEY$ = ""
LOOP
105
CLS
SCREEN 9
COLOR 14, 8
LINE (5, 5)-(630, 5), 12
LINE -(630, 338), 12
LINE -(5, 338), 12
LINE -(5, 5), 12
LINE (4, 4)-(631, 4), 3
LINE -(631, 339), 3
LINE -(4, 339), 3
LINE -(4, 4), 3
PRINT
PRINT
PRINT "                 DATA ENTRY FOR GRAPHIC"
INPUT "         What's total for Item 1"; de1
INPUT "         What's total for Item 2"; de2
INPUT "         What's total for Item 3"; de3
INPUT "         What's total for Item 4"; de4
INPUT "         What's total for Item 5"; de5
INPUT "         What's total for Item 6"; de6
INPUT "         What's total for Item 7"; de7
INPUT "         What's total for Item 8"; de8
INPUT "         What's total for Item 9"; de9
INPUT "         What's total for Item 10"; de10
INPUT "         What's total for Item 11"; de11
INPUT "         What's total for Item 12"; de12
PRINT
COLOR 10
INPUT "      What is the biggest Item number you entered above "; biggest
PRINT
INPUT "      What is the smallest Item number you entered above "; smallest
PRINT
PRINT
sum = de1 + de2 + de3 + de4 + de5 + de6 + de7 + de8 + de9 + de10 + de11 + de12
mean = sum / 12
sd = (biggest - smallest) / 4
PRINT "MEAN is "; mean
PRINT "STANDARD DEVIATION is "; sd
UCL! = mean + (3 * sd)
LCL! = mean - (3 * sd)
PRINT "  The upper control limit is "; UCL!
PRINT "  The lower control limit is "; LCL!
PRINT
COLOR 10
PRINT "                Tap Any Key to Continue"
DO WHILE INKEY$ = ""
LOOP
CLS
COLOR 14, 8
'LNG A-Z
LINE (5, 5)-(630, 5), 12
LINE -(630, 338), 12
LINE -(5, 338), 12
LINE -(5, 5), 12
LINE (4, 4)-(631, 4), 3
LINE -(631, 339), 3
LINE -(4, 339), 3
LINE -(4, 4), 3
PRINT
PRINT
PRINT "         What size and range of data do you want displayed?"
PRINT
COLOR 15
PRINT "      (1) Display data 0 - 10 Range (1-digit entries)"
PRINT "      (2) Display data 0 - 1000 Range (2-digit entries)"
INPUT "                  Make a Selection (1 or 2) "; range$
IF range$ = "2" THEN GOTO 600 ELSE GOTO 400
       'specs for the vertical  lines  (lines are X,Y)
400
CLS
SCREEN 12
'DEFSNG A-Z
LINE (100, 375)-(475, 375), 5    ' bottom line of graph
LINE (100, 376)-(475, 376), 5
LINE (100, 75)-(100, 376), 5     'this is vertical line of graph
LINE (101, 75)-(101, 376), 5
'
LOCATE 11, 60
COLOR 11
PRINT "UCL & LCL!"
LOCATE , 60
COLOR 15
PRINT "Shown by"
LOCATE , 60
PRINT "White LineS"
'     horizontal line separation is 30
LINE (100, 345)-(475, 345), 7  ' this is an add-on init.line
LINE (100, 315)-(475, 315), 7 ' this is an add-on init.line
LINE (100, 285)-(475, 285), 7  ' this is an add-on init.line
LINE (100, 255)-(475, 255), 7  ' this is an add-on init.line
LINE (100, 225)-(475, 225), 7  ' this is an add-on init.line
LINE (100, 195)-(465, 195), 7  ' this is an add-on init.line
LINE (100, 165)-(465, 165), 7  ' this is an add-on init.line
LINE (100, 135)-(475, 135), 7  ' this is an add-on init.line
LINE (100, 105)-(475, 105), 7  ' this is an add-on init.line
LOCATE 2, 3
COLOR 14
PRINT "INCIDENTS"
LOCATE 3, 28: PRINT "CONTROL LIMIT ANALYSIS FOR  "; namer$
LOCATE 3, 3: PRINT "RANGE 0 - 10"
LOCATE 25, 13
COLOR 15
PRINT TAB(13); "0"; TAB(17); "1"; TAB(21); "2"; TAB(24); "3"; TAB(28); "4"; TAB(32); "5"; TAB(36); "6"; TAB(39); "7"; TAB(43); "8"; TAB(46); "9"; TAB(50); "10"; TAB(54); "11"; TAB(58); "12"
LOCATE 26, 25
COLOR 5
PRINT "NUMBER OF ENTRIES SUBMITTED FOR THIS ANALYSIS"
LOCATE 24, 8
COLOR 14
PRINT "0"
LOCATE 22, 8
PRINT "1"
LOCATE 20, 8
PRINT "2"
LOCATE 18, 8
PRINT "3"
LOCATE 16, 8
PRINT "4"
LOCATE 14, 10
PRINT "5"
LOCATE 13, 8
PRINT "6"
LOCATE 11, 8
PRINT "7"
LOCATE 9, 8
PRINT "8"
LOCATE 7, 8
PRINT "9"
LOCATE 5, 8
PRINT "10"

'                       THIS SETS UP THE VERTICAL LINES
LINE (130, 75)-(130, 375), 7      '1
LINE (160, 75)-(160, 375), 7       '2
LINE (190, 75)-(190, 375), 7        '3
LINE (220, 75)-(220, 375), 7        '4
LINE (250, 75)-(250, 375), 7          '5
LINE (280, 75)-(280, 375), 7   '6
LINE (310, 75)-(310, 375), 7  '7
LINE (340, 75)-(340, 375), 7   '8      30 separation factor
LINE (370, 75)-(370, 375), 7   '9
LINE (400, 75)-(400, 375), 7   '10
LINE (430, 75)-(430, 375), 7   '11
LINE (460, 75)-(460, 375), 7   '12
'           this section computes the traceline points
'
'
'
UCL! = UCL! * .08         'these are set in arbitraily now and must
LCL! = UCL! * .15        'be accommodated before finalization
'
'
188                   
DEFLNG A-Z
hora = 375
' sets up the horizontal traces
hor1! = 375 - (de1 * 30)
up1! = hor1! - (UCL! * 30)
low1! = hor1! + (LCL! * 30)
hor2! = 375 - (de2 * 30)
up2! = hor2! - (UCL! * 30)
low2! = hor2! + (LCL! * 30)
hor3! = 375 - (de3 * 30)
up3! = hor3! - (UCL! * 30)
low3! = hor3! + (LCL! * 30)
hor4! = 375 - (de4 * 30)
up4! = hor4! - (UCL! * 30)
low4! = hor4! + (LCL! * 30)
hor5! = 375 - (de5 * 30)
up5! = hor5! - (UCL! * 30)
low5! = hor5! + (LCL! * 30)
hor6! = 375 - (de6 * 30)
up6! = hor6! - (UCL! * 30)
low6! = hor6! + (LCL! * 30)
hor7! = 375 - (de7 * 30)
up7! = hor7! - (UCL! * 30)
low7! = hor7! + (LCL! * 30)
hor8! = 375 - (de8 * 30)
up8! = hor8! - (UCL! * 30)
low8! = hor8! + (LCL! * 30)
hor9! = 375 - (de9 * 30)
up9! = hor9! - (UCL! * 30)
low9! = hor9! + (LCL! * 30)
hor10! = 375 - (de10 * 30)
up10! = hor10! - (UCL! * 30)
low10! = hor10! + (LCL! * 30)
hor11! = 375 - (de11 * 30)
up11! = hor11! - (UCL! * 30)
low11! = hor11! + (LCL! * 30)
hor12! = 375 - (de12 * 30)
up12! = hor12! - (UCL! * 30)
low12! = hor12! + (LCL! * 30)

'

'                    this section sets up the raw entry number  trace
177
LINE (100, 375)-(130, hor1!), 13
LINE (130, hor1!)-(160, hor2!), 13
LINE (160, hor2!)-(190, hor3!), 13
LINE (190, hor3!)-(220, hor4!), 13
LINE (220, hor4!)-(250, hor5!), 13
LINE (250, hor5!)-(280, hor6!), 13
LINE (280, hor6!)-(310, hor7!), 13
LINE (310, hor7!)-(340, hor8!), 13
LINE (340, hor8!)-(370, hor9!), 13
LINE (370, hor9!)-(400, hor10!), 13
LINE (400, hor10!)-(430, hor11!), 13
LINE (430, hor11!)-(460, hor12!), 13
166 '                 this section draws the UCL! trace line
LINE (100, 375)-(130, up1!), 15
LINE (130, up1!)-(160, up2!), 15
LINE (160, up2!)-(190, up3!), 15
LINE (190, up3!)-(220, up4!), 15
LINE (220, up4!)-(250, up5!), 15
LINE (250, up5!)-(280, up6!), 15
LINE (280, up6!)-(310, up7!), 15
LINE (310, up7!)-(340, up8!), 15
LINE (340, up8!)-(370, up9!), 15
LINE (370, up9!)-(400, up10!), 15
LINE (400, up10!)-(430, up11!), 15
LINE (430, up11!)-(460, up12!), 15
155 '       '         this section draws the LCL trace line
LINE (100, 375)-(130, low1!), 15
LINE (130, low1!)-(160, low2!), 15
LINE (160, low2!)-(190, low3!), 15
LINE (190, low3!)-(220, low4!), 15
LINE (220, low4!)-(250, low5!), 15
LINE (250, low5!)-(280, low6!), 15
LINE (280, low6!)-(310, low7!), 15
LINE (310, low7!)-(340, low8!), 15
LINE (340, low8!)-(370, low9!), 15
LINE (370, low9!)-(400, low10!), 15
LINE (400, low10!)-(430, low11!), 15
LINE (430, low11!)-(460, low12!), 15

END

'      THIS IS FOR GRAPH SHOWING 0 TO 100(100, 200 . . .800,900, ETC)
600
CLS
SCREEN 12
'DEFLNG A-Z
LINE (100, 375)-(475, 375), 5    ' bottom line of graph
LINE (100, 376)-(475, 376), 5
LINE (100, 75)-(100, 376), 5     'this is vertical line of graph
LINE (101, 75)-(101, 376), 5
'
LOCATE 11, 60
COLOR 11
PRINT "UCL! & LCL"
COLOR 15
LOCATE , 60
PRINT "Shown by"
LOCATE , 60
PRINT "White LineS"
'     horizontal line separation is 30
LINE (100, 345)-(475, 345), 11  ' this is an add-on init.line
LINE (100, 315)-(475, 315), 11 ' this is an add-on init.line
LINE (100, 285)-(475, 285), 11  ' this is an add-on init.line
LINE (100, 255)-(475, 255), 11  ' this is an add-on init.line
LINE (100, 225)-(475, 225), 11  ' this is an add-on init.line
LINE (100, 195)-(465, 195), 11  ' this is an add-on init.line
LINE (100, 165)-(465, 165), 11  ' this is an add-on init.line
LINE (100, 135)-(475, 135), 11  ' this is an add-on init.line
LINE (100, 105)-(475, 105), 11  ' this is an add-on init.line
    '          this section shows graph for 3-digit entries to 1000
LOCATE 3, 3
COLOR 14
PRINT "INCIDENTS"
LOCATE 3, 28: PRINT "CONTROL LIMIT ANALYSIS FOR  "; namer$
LOCATE 4, 3: PRINT "RANGE 0-1000"
LOCATE 25, 13
COLOR 15
PRINT TAB(13); "0"; TAB(17); "1"; TAB(21); "2"; TAB(24); "3"; TAB(28); "4"; TAB(32); "5"; TAB(36); "6"; TAB(39); "7"; TAB(43); "8"; TAB(46); "9"; TAB(50); "10"; TAB(54); "11"; TAB(58); "12"
LOCATE 26, 15
COLOR 5
PRINT "NUMBER OF ENTRIES SUBMITTED FOR ANALYSIS"
LOCATE 24, 8
COLOR 14
PRINT "0"
LOCATE 22, 8
PRINT "100"
LOCATE 20, 8
PRINT "200"
LOCATE 18, 8
PRINT "300"
LOCATE 16, 8
PRINT "400"
LOCATE 15, 8
PRINT "500"
LOCATE 13, 8
PRINT "600"
LOCATE 11, 8
PRINT "700"
LOCATE 9, 8
PRINT "800"
LOCATE 7, 8
PRINT "900"
LOCATE 5, 8
PRINT "1000"

'                       THIS SETS UP THE VERTICAL LINES
LINE (130, 75)-(130, 375), 11      '1
LINE (160, 75)-(160, 375), 11       '2
LINE (190, 75)-(190, 375), 11        '3
LINE (220, 75)-(220, 375), 11        '4
LINE (250, 75)-(250, 375), 11          '5
LINE (280, 75)-(280, 375), 11   '6
LINE (310, 75)-(310, 375), 11  '7
LINE (340, 75)-(340, 375), 11   '8      30 separation factor
LINE (370, 75)-(370, 375), 11   '9
LINE (400, 75)-(400, 375), 11   '10
LINE (430, 75)-(430, 375), 11   '11
LINE (460, 75)-(460, 375), 11   '12
'           this section draws the traceline
'
'
'
'UCL = UCL * .1   'these are set in arbitraily now and must
'LCL = LCL * .15         'be accommodated before finalization
'
888
DEFLNG A-Z
'
hora = 375
hor1! = 375 - (de1 * .3)
up1! = hor1! - (UCL! * .3)
low1! = hor1! + (LCL! * .3)
hor2! = 375 - (de2 * .3)
up2! = hor2! - (UCL! * .3)
low2! = hor2! + (LCL! * .3)
hor3! = 375 - (de3 * .3)
up3! = hor3! - (UCL! * .3)
low3! = hor3! + (LCL! * .3)
hor4! = 375 - (de4 * .3)
up4! = hor4! - (UCL! * .3)
low4! = hor4! + (LCL! * .3)
hor5! = 375 - (de5 * .3)
up5! = hor5! - (UCL! * .3)
low5! = hor5! + (LCL! * .3)
hor6! = 375 - (de6 * .3)
up6! = hor6! - (UCL! * .3)
low6! = hor6! + (LCL! * .3)
hor7! = 375 - (de7 * .3)
up7! = hor7! - (UCL! * .3)
low7! = hor7! + (LCL! * .3)
hor8! = 375 - (de8 * .3)
up8! = hor8! - (UCL! * .3)
low8! = hor8! + (LCL! * .3)
hor9! = 375 - (de9 * .3)
up9! = hor9! - (UCL! * .3)
low9! = hor9! + (LCL! * .3)
hor10! = 375 - (de10 * .3)
up10! = hor10! - (UCL! * .3)
low10! = hor10! + (LCL! * .3)
hor11! = 375 - (de11 * .3)
up11! = hor11! - (UCL! * .3)
low11! = hor11! + (LCL! * .3)
hor12! = 375 - (de12 * .3)
up12! = hor12! - (UCL! * .3)
low12! = hor12! + (LCL! * .3)
777      'this section draws the white LCL trace lines
LINE (100, 375)-(130, low1!), 15
LINE (130, low1!)-(160, low2!), 15
LINE (160, low2!)-(190, low3!), 15
LINE (190, low3!)-(220, low4!), 15
LINE (220, low4!)-(250, low5!), 15
LINE (250, low5!)-(280, low6!), 15
LINE (280, low6!)-(310, low7!), 15
LINE (310, low7!)-(340, low8!), 15
LINE (340, low8!)-(370, low9!), 15
LINE (370, low9!)-(400, low10!), 15
LINE (400, low10!)-(430, low11!), 15
LINE (430, low11!)-(460, low12!), 15
666      'this section draws the yellow UCL trace lines
LINE (100, 375)-(130, up1!), 14
LINE (130, up1!)-(160, up2!), 14
LINE (160, up2!)-(190, up3!), 14
LINE (190, up3!)-(220, up4!), 14
LINE (220, up4!)-(250, up5!), 14
LINE (250, up5!)-(280, up6!), 14
LINE (280, up6!)-(310, up7!), 14
LINE (310, up7!)-(340, up8!), 14
LINE (340, up8!)-(370, up9!), 14
LINE (370, up9!)-(400, up10!), 14
LINE (400, up10!)-(430, up11!), 14
LINE (430, up11!)-(460, up12!), 14
555             '   this section sets up the red RAW DTAT trace line
LINE (100, 375)-(130, hor1!), 5
LINE (130, hor1!)-(160, hor2!), 5
LINE (160, hor2!)-(190, hor3!), 5
LINE (190, hor3!)-(220, hor4!), 5
LINE (220, hor4!)-(250, hor5!), 5
LINE (250, hor5!)-(280, hor6!), 5
LINE (280, hor6!)-(310, hor7!), 5
LINE (310, hor7!)-(340, hor8!), 5
LINE (340, hor8!)-(370, hor9!), 5
LINE (370, hor9!)-(400, hor10!), 5
LINE (400, hor10!)-(430, hor11!), 5
LINE (430, hor11!)-(460, hor12!), 5


END


