Solutions Company Statit Training Home
 



Adding a New Line to a Quality Control Chart

Abstract: It is often desirable to add another data line to a QC Chart.

Products: Statit e-QC, Statit e-Server, Statit Custom QC

Since you just want to do a comparison to the variable already displayed on the control chart and do not need control limit and centerline calculations, it is relatively easy to add a second analysis variable to the chart. We will need to use the barline Statit graphics command. Pretend as a guidance counselor I have several students who I have given targets for their GPA. I would like to see the quality control chart for all of my students GPA, but also see how their GPA compares to what I set as their target. Follow the comments in the macro below:

## Using the sample file "student.wrk", I will create another variable
## TargetGPA to represent a line with the target GPA values to place on top
## of my QC chart.
## Be sure this variable as the same number of cases as the original!!
getf student.wrk /be
assign TargetGPA 3.2 3.4 3.5 3.6 3.7 3.3 3.4 2.5 3.0 3.2 2.8 3.2
## I will first generate the I-Chart for GPA with a /nodraw option
gichart GPA by 2 /axis=Name /tip_stats = data x /nodraw /ymin=0
## Next, I begin to add some custom graphics commands
## For QC charts, I need to place the barline on chart 2
chart 2 current
## Now, add the new barline using new target GPA variable
barline 2 TargetGPA /color=Green /linestyle=solid ;
/marker=zero /linewidth=5 ;
/style=line /legend="Target GPA"
## Make barline 1 match format of barline 2
barline 1 /legend="GPA" /marker=zero
## Use the following commands to add a nice legend
## in the upper right hand corner.
legend /box=yes /boxcolor=White ;
/boxborder=Black /location=950,900 /display = column
## Finally, draw the chart
draw

The result is a graph with two lines displayed for comparison. The control limits in this example are based on the "GPA" variable and the "Target GPA" is added for comparison analysis only.