IMSL C# Programmers Guide
|
Quality Control and Improvement Charts >> CChart |
CChart
CChart
plots the number of defects or nonconformities.
The number of defects in samples of 100 printed circuit boards was measured (Montgomery 321).
(Download Code)using Imsl.Chart2D; using Imsl.Chart2D.QC; public class SampleCChart : FrameChart { static int[] numberDefects = { 21, 24, 16, 12, 15, 5, 28, 20, 31, 25, 20, 24, 16, 19, 10, 17, 13, 22, 18, 39, 30, 24, 16, 19, 17, 15 }; public SampleCChart() { Chart chart = this.Chart; AxisXY axis = new AxisXY(chart); CChart cchart = new CChart(axis, numberDefects); axis.AxisX.AxisTitle.SetTitle(Sample Number); axis.AxisX.AxisLabel.TextFormat = 0; axis.AxisY.AxisTitle.SetTitle(Number of Defects); } public static void Main(string[] argv) { System.Windows.Forms.Application.Run(new SampleCChart()); } }
CChartOmit Example
This is similar to the previous chart, but two points are omitted from the statistical computations.
To do this, first the censored chart is created with the bad points omitted. The positions of the control limits in this chart are saved. This censored chart is then removed from the chart.
The second step is to create a chart using later data points, but with the position of the control limit limits set to the values computed using the censored data.
(Download Code)using Imsl.Chart2D; using Imsl.Chart2D.QC; public class SampleCChartOmit : FrameChart { static int[] numberDefects = { 21, 24, 16, 12, 15, 5, 28, 20, 31, 25, 20, 24, 16, 19, 10, 17, 13, 22, 18, 39, 30, 24, 16, 19, 17, 15 }; static int[] censoredNumberDefects = { 21, 24, 16, 12, 15, /*5,*/ 28, 20, 31, 25, 20, 24, 16, 19, 10, 17, 13, 22, 18, /*39,*/ 30, 24, 16, 19, 17, 15 }; static int[] furtherNumberDefects = { 16, 18, 12, 15, 24, 21, 28, 20, 25, 19, 18, 21, 16, 22, 19, 12, 14, 9, 16, 21 }; public SampleCChartOmit() { Chart chart = this.Chart; AxisXY axis = new AxisXY(chart); CChart censoredCChart = new CChart(axis, censoredNumberDefects); double lcl = censoredCChart.LowerControlLimit.GetValue()[0]; double center = censoredCChart.Center; double ucl = censoredCChart.UpperControlLimit.GetValue()[0]; censoredCChart.Remove(); double[] x = new double[furtherNumberDefects.Length]; for (int i = 0; i < x.Length; i++) { x[i] = numberDefects.Length + i; } CChart fullCChart = new CChart(axis, furtherNumberDefects); fullCChart.ControlData.SetX(x); fullCChart.LowerControlLimit.SetValue(lcl); fullCChart.CenterLine.SetValue(center); fullCChart.UpperControlLimit.SetValue(ucl); axis.AxisX.AxisTitle.SetTitle(Sample Number); axis.AxisX.AxisLabel.TextFormat = 0; axis.AxisY.AxisTitle.SetTitle(Number Defective); } public static void Main(string[] argv) { System.Windows.Forms.Application.Run(new SampleCChartOmit()); } }
© Visual Numerics, Inc. All rights reserved. |