StatBean Name: FrequencyPolygon

Purpose: Constructs a frequency polygon or cumulative distribution function to show the distribution of numeric data.

DataSource: Tabulation.


Read/Write Properties
NameTypeDescriptionPossible ValuesDefault Value
cumulativebooleanWhether to plot cumulative frequencies.true,falsefalse
scaleByPercentagebooleanWhether to scale the axes by percentage rather than frequency.true,falsefalse

Code Sample

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

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

//create a calculation bean
Tabulation tabulation1 = new STATBEANS.Tabulation();

//set the column to be tabulated
tabulation1.setXVariableName("mpg");

//set the type of tabulation and the limits
tabulation1.setDataType("Continuous");
tabulation1.setFrom(0.0);
tabulation1.setTo(60.0);
tabulation1.setBy(5.0);

//create a chart bean
FrequencyPolygon polygon1 = new STATBEANS.FrequencyPolygon();

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

//make the plot bean a listener for changes in the tabulation bean
tabulation1.addDataChangeListener(polygon1.listenerForDataChange);

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