Example: EWMA Chart
A process is monitored using the EWMA control chart. The data is from NIST Engineering Statistics Handbook: EWMA Control Charts
. This class can be used either as an applet or as an application.
import com.imsl.chart.*;
import com.imsl.chart.qc.*;
public class EWMAEx1 extends javax.swing.JApplet {
static private final double data[] = {
52.0, 47.0, 53.0, 49.3, 50.1, 47.0,
51.0, 50.1, 51.2, 50.5, 49.6, 47.6,
49.9, 51.3, 47.8, 51.2, 52.6, 52.4,
53.6, 52.1
};
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);
double lambda = 0.3;
EWMA ewma = new EWMA(axis, data, lambda);
ewma.getControlData().setMarkerColor("blue");
}
public static void main(String argv[]) {
JFrameChart frame = new JFrameChart();
EWMAEx1.setup(frame.getChart());
frame.setVisible(true);
}
}
Output
Link to Java source.