JMSL Chart Programmer’s Guide
NpChart
NpChart is similar to PChart, except that the number of defects per sample is plotted, not the sample rate. The position of the control limits are given by
where n is the number of items and p is the proportion of defective items.
NpChart Example
View code file
This example uses the orange juice can manufacturing data used earlier in the PChart example. In this example, the number of defects, rather than the defect rate is plotted.
 
import com.imsl.chart.*;
import com.imsl.chart.qc.*;
 
public class SampleNpChart extends JFrameChart {
public SampleNpChart() {
Chart chart = getChart();
AxisXY axis = new AxisXY(chart);
NpChart npchart =
new NpChart(axis, SamplePChart.sampleSize,
SamplePChart.numberDefects);
axis.getAxisX().getAxisTitle().setTitle("Sample Number");
axis.getAxisX().getAxisLabel().setTextFormat("0");
axis.getAxisY().getAxisTitle().setTitle("Number Defective");
}
public static void main(String argv[]) {
new SampleNpChart().setVisible(true);
}
}