StatBean Name: ComponentChart

Purpose: Displays a component line chart for two or more time series with filled areas.

DataSource: any.


Read/Write Properties
NameTypeDescriptionPossible ValuesDefault Value
forceEqualScalesbooleanWhether to force the x-axis and y-axis scaling to be the same.true,falsefalse
showLegendsbooleanWhether to display legends at the right of the plot.true,falsetrue
suppressXaxisbooleanWhether to suppress display of the x-axis scaling and ticmarks.true,falsefalse
suppressYaxisbooleanWhether to suppress display of the y-axis scaling and ticmarks.true,falsefalse
tablewiseExclusionbooleanWhether all rows of the data table containing a missing value in any column should be excluded from the plot.true,falsefalse
timeScaleStringThe type of time units."Year","Quarter","Month","Day",
"Hour","Minute","Second","Other"
"Other"
xVariableNameStringThe name of the column with data values to be plotted on the horizontal axis.Any string.
yVariableNamesString[]The name of one or more columns with data values to be plotted on the vertical axis.Any string.

Other properties are inherited from the java.awt.Canvas class and from the general GraphicalStatbean class.

Code Sample

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

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

//set the delimiter character used in the file
fileDataSource1.setDelimiter("comma");

//create a plot bean
ComponentChart chart1 = new STATBEANS.ComponentChart();

//set the columns for the x and y axes
chart1.setXVariableName("Month");
String ynames[]={"Domestic","International"};
chart1.setYVariableNames(ynames);

//set the type of time units
chart1.setTimeScale("Month");

//override the top title
xYPlot1.setTopTitleLine1("Sample Component Chart");

//override the axis titles
chart1.setXaxisTitle("month");
chart1.setYaxisTitle("units");

//add the plot to the application frame
add(chart1);

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

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