JMSLTM Numerical Library 5.0.1

com.imsl.chart.qc
Class ShewhartControlChart

java.lang.Object
  extended by com.imsl.chart.AbstractChartNode
      extended by com.imsl.chart.ChartNode
          extended by com.imsl.chart.Data
              extended by com.imsl.chart.qc.ShewhartControlChart
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
CChart, CuSum, CuSumStatus, EWMA, NpChart, PChart, RChart, SChart, UChart, XbarR, XbarS, XmR

public class ShewhartControlChart
extends Data

ShewhartControlChart is the base class for the Shewhart control charts.

The control limits are generally calculated as

mathrm{center} + ksigma

where the meaning of center and sigma depend on the specific control chart being drawn. The variable k is the value of the attribute "ControlLimit" associated with the line being drawn. Typically there are three lines with k=-3, 0, 3.

If all of the samples sizes are equal, the lines are horizontal. If the sample sizes are unequal, the lines have a "stairstep" pattern. Horizontal lines have a title drawn just above the line and right-adjusted on the chart. The contents of the title is determined by the line's "Title" attribute. If the title contains the placeholder "{0}", it is replaced by the lines value. This replacement is done using MessageFormat.

See Also:
Serialized Form

Field Summary
static double[] d2
          This field contains d_{2,n} the mean of the ranges of n samples from a Gaussian distribution.
static double[] d3
          This field contains d_{3,n} the standard deviation of the ranges of n samples from a Gaussian distribution.
 
Fields inherited from class com.imsl.chart.ChartNode
AXIS_X_TOP, AXIS_Y_RIGHT, BAR_TYPE_HORIZONTAL, BAR_TYPE_VERTICAL, DASH_PATTERN_DASH, DASH_PATTERN_DASH_DOT, DASH_PATTERN_DOT, DASH_PATTERN_SOLID, DATA_TYPE_FILL, DATA_TYPE_LINE, DATA_TYPE_MARKER, DATA_TYPE_PICTURE, DATA_TYPE_TUBE, DENDROGRAM_TYPE_HORIZONTAL, DENDROGRAM_TYPE_VERTICAL, FILL_TYPE_GRADIENT, FILL_TYPE_NONE, FILL_TYPE_PAINT, FILL_TYPE_SOLID, LABEL_TYPE_PERCENT, MARKER_TYPE_ASTERISK, MARKER_TYPE_CIRCLE_CIRCLE, MARKER_TYPE_CIRCLE_PLUS, MARKER_TYPE_CIRCLE_X, MARKER_TYPE_DIAMOND_PLUS, MARKER_TYPE_FILLED_CIRCLE, MARKER_TYPE_FILLED_DIAMOND, MARKER_TYPE_FILLED_SQUARE, MARKER_TYPE_FILLED_TRIANGLE, MARKER_TYPE_HOLLOW_CIRCLE, MARKER_TYPE_HOLLOW_DIAMOND, MARKER_TYPE_HOLLOW_SQUARE, MARKER_TYPE_HOLLOW_TRIANGLE, MARKER_TYPE_OCTAGON_PLUS, MARKER_TYPE_OCTAGON_X, MARKER_TYPE_PLUS, MARKER_TYPE_SQUARE_PLUS, MARKER_TYPE_SQUARE_X, MARKER_TYPE_X, TEXT_X_CENTER, TEXT_X_LEFT, TEXT_X_RIGHT, TEXT_Y_BOTTOM, TEXT_Y_CENTER, TEXT_Y_TOP
 
Fields inherited from class com.imsl.chart.AbstractChartNode
AUTOSCALE_DATA, AUTOSCALE_DENSITY, AUTOSCALE_NUMBER, AUTOSCALE_OFF, AUTOSCALE_WINDOW, AXIS_X, AXIS_Y, AXIS_Z, LABEL_TYPE_NONE, LABEL_TYPE_TITLE, LABEL_TYPE_X, LABEL_TYPE_Y, LABEL_TYPE_Z, TRANSFORM_CUSTOM, TRANSFORM_LINEAR, TRANSFORM_LOG
 
Constructor Summary
ShewhartControlChart(AxisXY axis)
          Constructs a Shewhart control chart.
 
Method Summary
 ControlLimit addCenterLine()
          Adds the center line to the control chart and returns the newly added line.
 ControlLimit addControlLimit()
          Adds a control limit to the chart.
 ControlLimit addLowerControlLimit()
          Creates lower ControlLimit, adds it to the control chart, and returns the newly created object.
 ControlLimit addUpperControlLimit()
          Creates upper ControlLimit, adds it to the control chart, and returns the newly created object.
 ControlLimit[] addWecoLimits()
          Adds lines for the Western Electric Company Rules.
 void dataRange(double[] range)
          Update the data range, range = {xmin,xmax,ymin,ymax}.
 double getCenter()
          Returns the value of the attribute "Center".
 ControlLimit getCenterLine()
          Returns the center line.
 Data getControlData()
          Returns the Data object for the control data.
 ControlLimit getLowerControlLimit()
          Returns the lower control limit.
 double getMeanSampleSize()
          Returns the value of the attribute "MeanSampleSize".
 int[] getSampleSize()
          Returns the value of the attribute "SampleSize".
 ControlLimit getUpperControlLimit()
          Returns the upper control limit.
 void paint(Draw draw)
          Paints this node and all of its children.
 void removeControlLimit(ControlLimit line)
          Removes a control limit from the chart.
 void setCenter(double center)
          Sets the value of the attribute "Center".
 Data setData(double[] y)
          Sets the data in the control chart.
 Data setData(int[] y)
          Sets the integer data in the control chart.
 void setSampleSize(int sampleSize)
          Sets the value of the attribute "SampleSize".
 void setSampleSize(int[] sampleSize)
          Sets the value of the attribute "SampleSize".
 void setX(double[] x)
          Sets the x-coordinates of the data.
 
Methods inherited from class com.imsl.chart.Data
formatLabel
 
Methods inherited from class com.imsl.chart.ChartNode
addPickListener, firePickListeners, getALT, getAxis, getBackground, getBarGap, getBarType, getBarWidth, getChart, getChartTitle, getChildren, getClipData, getComponent, getConcatenatedViewport, getDataType, getDoubleBuffering, getExplode, getFillOutlineColor, getFillOutlineType, getFillPaint, getFillType, getGradient, getHREF, getLegend, getLineDashPattern, getMarkerDashPattern, getMarkerThickness, getMarkerType, getParent, getReference, getScreenAxis, getScreenSize, getScreenViewport, getSize, getSkipWeekends, getTextAngle, getTextColor, getTitle, getToolTip, getViewport, isBitSet, prePaint, removePickListener, setALT, setBarGap, setBarType, setBarWidth, setChartTitle, setClipData, setCustomTransform, setDataType, setDoubleBuffering, setExplode, setFillOutlineColor, setFillOutlineColor, setFillOutlineType, setFillPaint, setFillPaint, setFillPaint, setFillType, setGradient, setGradient, setGradient, setHREF, setImage, setLineDashPattern, setMarkerDashPattern, setMarkerThickness, setMarkerType, setReference, setScreenSize, setSize, setSkipWeekends, setTextAngle, setTextColor, setTextColor, setTitle, setTitle, setToolTip, setViewport, setViewport
 
Methods inherited from class com.imsl.chart.AbstractChartNode
clone, clone, clone, clone, getAbstractParent, getAttribute, getAutoscaleInput, getAutoscaleMinimumTimeInterval, getAutoscaleOutput, getBooleanAttribute, getChildList, getColorAttribute, getCustomTransform, getDensity, getDoubleAttribute, getFillColor, getFont, getFontName, getFontSize, getFontStyle, getImage, getIntegerAttribute, getLabelType, getLightColor, getLineColor, getLineWidth, getLocale, getMarkerColor, getMarkerSize, getName, getNumber, getPaint, getStringAttribute, getTextFormat, getTickLength, getTransform, getX, getY, isAncestorOf, isAttributeSet, isAttributeSetAtThisNode, parseColor, remove, setAttribute, setAutoscaleInput, setAutoscaleMinimumTimeInterval, setAutoscaleOutput, setDensity, setFillColor, setFillColor, setFont, setFontName, setFontSize, setFontStyle, setImage, setLabelType, setLightColor, setLightColor, setLineColor, setLineColor, setLineWidth, setLocale, setMarkerColor, setMarkerColor, setMarkerSize, setName, setNumber, setPaint, setTextFormat, setTextFormat, setTickLength, setTransform, setX, setY, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

d2

public static final double[] d2
This field contains d_{2,n} the mean of the ranges of n samples from a Gaussian distribution. The entries for n= 0 and 1 are NaN because these values are not defined. Valid entries in the table are for n=2 through 50.


d3

public static final double[] d3
This field contains d_{3,n} the standard deviation of the ranges of n samples from a Gaussian distribution. The entries for n= 0 and 1 are NaN because these values are not defined. Valid entries in the table are for n=2 through 50.

Constructor Detail

ShewhartControlChart

public ShewhartControlChart(AxisXY axis)
Constructs a Shewhart control chart.

Parameters:
axis - the AxisXY parent of this node
Method Detail

addCenterLine

public ControlLimit addCenterLine()
Adds the center line to the control chart and returns the newly added line.

Returns:
the ControlLimit which draws the center line.

addControlLimit

public ControlLimit addControlLimit()
Adds a control limit to the chart. These can be used as tolerance limit lines or warning control limit lines.

Returns:
a ControlLimit object.

addLowerControlLimit

public ControlLimit addLowerControlLimit()
Creates lower ControlLimit, adds it to the control chart, and returns the newly created object.

Returns:
the ControlLimit which draws the lower control limit line.

addUpperControlLimit

public ControlLimit addUpperControlLimit()
Creates upper ControlLimit, adds it to the control chart, and returns the newly created object.

Returns:
the ControlLimit which draws the upper control limit line.

addWecoLimits

public ControlLimit[] addWecoLimits()
Adds lines for the Western Electric Company Rules. These additional lines are at

mathrm{center} + ksigma~~~~mathrm{for}~k=-2,-1,1,2

The meaning of center and sigma depend on the chart to which these lines are added. The "LineColor" attribute for these lines is set to yellow.

Returns:
an array containing the four added lines. They are in order with the ControlLimit corresponding to k = -2 first and the ControlLimit corresponding to k = +2 last.

dataRange

public void dataRange(double[] range)
Update the data range, range = {xmin,xmax,ymin,ymax}. The entries in range are updated to reflect the extent of the data in this node. The argument range is an input/output variable. Its value should be updated only if the data in this node is outside the range already in the array.

Overrides:
dataRange in class Data
Parameters:
range - a double array which contains the updated range, {xmin,xmax,ymin,ymax}

getCenter

public double getCenter()
Returns the value of the attribute "Center". This is used to position the center line.

Returns:
the value of the attribute "Center". Its default value is 0.

getCenterLine

public ControlLimit getCenterLine()
Returns the center line.

Returns:
the ControlLimit which draws the center line.

getControlData

public Data getControlData()
Returns the Data object for the control data.

Returns:
a Data object for charting the control data.

getLowerControlLimit

public ControlLimit getLowerControlLimit()
Returns the lower control limit.

Returns:
the ControlLimit which draws the lower control limit line.

getMeanSampleSize

public double getMeanSampleSize()
Returns the value of the attribute "MeanSampleSize". This is set by the method setSampleSize. Its default value is zero.

Returns:
the average sample size

getSampleSize

public int[] getSampleSize()
Returns the value of the attribute "SampleSize".

Returns:
sampleSize is the value of the attribute "SampleSize". Its default value is an array of length one containing a one, (new int[]{1}).

getUpperControlLimit

public ControlLimit getUpperControlLimit()
Returns the upper control limit.

Returns:
the ControlLimit which draws the upper control limit line.

paint

public void paint(Draw draw)
Paints this node and all of its children. This is normally called only by the paint method in this node's parent.

Overrides:
paint in class Data
Parameters:
draw - a Draw object which specifies the chart tree to be rendered on the screen

removeControlLimit

public void removeControlLimit(ControlLimit line)
Removes a control limit from the chart.

Parameters:
line - is the ControlLimit object to be removed from this chart.

setCenter

public void setCenter(double center)
Sets the value of the attribute "Center". This is used to position the center line. Its default value is 0.

Parameters:
center - is the value of the attribute "Center".

setData

public Data setData(double[] y)
Sets the data in the control chart. By default, the data points are drawn as filled circle markers connected by a line.

Parameters:
y - is an array containing the data values.
Returns:
a Data object containing the data points.

setData

public Data setData(int[] y)
Sets the integer data in the control chart. By default, the data points are drawn as filled circle markers connected by a line.

Parameters:
y - is an array containing the data values.
Returns:
a Data object containing the data points.

setSampleSize

public void setSampleSize(int sampleSize)
Sets the value of the attribute "SampleSize". Its default value is an array of length one containing a one, (new int[]{1}).

Parameters:
sampleSize - is the value of the attribute "SampleSize".

setSampleSize

public void setSampleSize(int[] sampleSize)
Sets the value of the attribute "SampleSize".

Parameters:
sampleSize - is the value of the attribute "SampleSize".

setX

public void setX(double[] x)
Sets the x-coordinates of the data. The "X" chart attribute of each ControlLimit added to this chart is also set. If not set the values 0, 1, 2, ... are used.

Parameters:
x - is an array containing the x-coordinates. The length of x must equal the length of the data array used to construct this object.

JMSLTM Numerical Library 5.0.1

Copyright © 1970-2008 Visual Numerics, Inc.
Built July 8 2008.