Example: R Chart
During a manufacturing process 15 samples, each containing 3 to 5 items, were measured. An R chart was contructed from the 15 sample ranges. Since the sample sizes are unequal the upper control limit is a stair step line. This class can be used either as an applet or as an application.
import com.imsl.chart.*;
import com.imsl.chart.qc.*;
public class RChartEx1 extends javax.swing.JApplet {
static private final double data[][] = {
{44.73, 45.47, 45.39, 45.33, 45.24},
{45.57, 46.87, 45.40},
{46.39, 45.31, 46.74, 46.06, 45.51},
{45.54, 46.27, 44.57, 45.36},
{45.58, 45.59, 46.02, 45.45, 46.42},
{45.91, 45.38, 44.98, 44.91, 45.17},
{45.98, 45.29, 45.50, 45.77, 46.44},
{46.30, 45.65, 45.21, 45.43},
{45.77, 45.38, 45.65, 45.25, 45.89},
{44.10, 45.53, 44.65},
{45.95, 46.22, 45.92, 45.90},
{44.87, 44.98, 45.91, 45.18, 45.64},
{44.70, 45.89, 45.84, 45.07},
{45.90, 45.80, 46.30, 46.34, 46.34},
{44.90, 46.23, 45.16}
};
public void init() {
Chart chart = new Chart(this);
JPanelChart panel = new JPanelChart(chart);
getContentPane().add(panel, java.awt.BorderLayout.CENTER);
setup(chart);
}
static private void setup(Chart chart) {
AxisXY axis = new AxisXY(chart);
new RChart(axis, data);
}
public static void main(String argv[]) {
JFrameChart frame = new JFrameChart();
RChartEx1.setup(frame.getChart());
frame.setVisible(true);
}
}
Output
Link to Java source.