Example: CuSumStatus Chart

A process is monitored using the CuSumStatus control chart. The solid red bars indicate the process is out-of-control. The hollow green bars indicate that the process is in control. The data is from NIST Engineering Statistics Handbook: CuSumStatus Control Charts . This class can be used either as an applet or as an application.
import com.imsl.chart.*;
import com.imsl.stat.Summary;
import com.imsl.chart.qc.CuSumStatus;

public class CuSumStatusEx1 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);
    }
    
    private void setup(final Chart chart) {
        AxisXY axis = new AxisXY(chart);
        double mean = Summary.mean(data);
        double slackValue = 0.5;
        CuSumStatus cusum = new CuSumStatus(axis, data, mean, slackValue);
        cusum.getBarPlus().getBarSet(0,0).setFillType(cusum.FILL_TYPE_NONE);
        cusum.getBarMinus().getBarSet(0,0).setFillType(cusum.FILL_TYPE_NONE);
        cusum.getBarPlus().getBarSet(0,0).setFillOutlineColor(
                java.awt.Color.green);
        cusum.getBarMinus().getBarSet(0,0).setFillOutlineColor(
                java.awt.Color.green);
    }

    public static void main(String argv[]) {
        JFrameChart frame = new JFrameChart();
        new CuSumStatusEx1().setup(frame.getChart());
        frame.setVisible(true);
    }
}

Output

eqn_0386

Link to Java source.