StatBean Name: BoxAndWhiskerPlot

Purpose: Creates a box-and-whisker plot for one or more columns of numeric data.

DataSource: Any.


Read/Write Properties
NameTypeDescriptionPossible ValuesDefault Value
boxWidthintPercentage of plotting area covered by the box.10-10040
columnNamesString arrayThe names of the columns (if more than one) to be analyzed.One or more strings.{""}
confidenceLeveldoubleLevel of confidence for the prediction and confidence limits, as a percentage.0.0001-99.999995.0
drawVerticalbooleanWhether to draw the box in the vertical direction.true,falsefalse
flagOutsidePointsbooleanWhether to add point symbols showing values unusually far from the box.true,falsetrue
meanSymbolbooleanWhether to add a plus sign showing the sample mean.true,falsetrue
medianNotchbooleanWhether to add a notch showing a confidence interval for the median.true,falsefalse
rotateClassLabelsbooleanWhether to make the class labels vertical.true,falsefalse
tablewiseExclusionbooleanWhether all rows of the data table containing a missing value in any column should be excluded from the plot.true,falsefalse
xVariableNameStringThe name of the column (if only one) with data values to be plotted on the horizontal axis.Any string.""

Other Public Methods
NameDescriptionArgumentsReturn Value
int getNumberOutside()Returns the number of outside points.None.Number of data values more than 1.5 times the interquartile range from the box.
int getNumberOutside(int k)Returns the number of outside points for sample k.Sample number (0 origin).Number of data values more than 1.5 times the interquartile range from the box.
int getNumberFarOutside()Returns the number of far outside points.None.Number of data values more than 3.0 times the interquartile range from the box.
int getNumberFarOutside(int k)Returns the number of far outside points for sample k.Sample number (0 origin).Number of data values more than 1.5 times the interquartile range from the box.
boolean isOverlap(int i,int j)Indicates whether or not the median notches overlap.Sample number 1, sample number 2 (0 origin).True if notches overlap.


Code Sample

//create a datasource bean
FileDataSource fileDataSource1 = new STATBEANS.FileDataSource();

//set the file name to be read
fileDataSource1.setFileName("c:\\statbeans\\samples\\spc.txt");

//create a chart bean
BoxAndWhiskerPlot boxandwhiskerplot1 = new STATBEANS.BoxAndWhiskerPlot();
boxandwhiskerplot1.setBackground(java.awt.Color.yellow);
boxandwhiskerplot1.setBounds(16,30,380,300);

//set the column to be plotted
boxandwhiskerplot1.setXVariableName("strength");

//add a median notch
boxandwhiskerplot1.setMedianNotch(true);

//permit point identification using the mouse
boxandwhiskerplot1.setHighlightPointOnMouseClick(true);
boxandwhiskerplot1.setShowPointClickedMessage(true);

//show the plot
add(boxandwhiskerplot1);

//make the plot bean a listener for changes in the FileDataSource bean
fileDataSource1.addDataChangeListener(boxandwhiskerplot1.listenerForDataChange);

//instruct the fileDataSource bean to read the file
fileDataSource1.readData();