BarChart.CreateWithFreq

Prototypes

static BarChart CreateWithFreq( DataObject dobj, String sXVarName, String sFreqVarName <, boolean bShow> )

static BarChart CreateWithFreq( String sDataName, Matrix mX, Matrix mFreq <, boolean bShow> )

Return Value

The return value is a reference to the newly created BarChart object.

Parameters

DataObject dobj
The DataObject containing the variables you want to plot.

String sXVarName
The name of the variable you want to assign to the X axis. This variable specifies the categories to be plotted.

String sFreqVarName
The name of the variable you want to use as the frequency variable. The ith value of this variable specifies the frequency of the ith value of the X variable.

boolean bShow
If bShow is true, the plot's window is displayed. If bShow is false, the plot's window is hidden. Calling this method without specifying bShow is equivalent to calling it with bShow equal to true.

String sDataName
The name to assign to the DataObject created internally by this method.

Matrix mX
A vector specifying the categories you want to plot. This vector is used to create a DataObject and then that DataObject is used to create a BarChart.

Matrix mFreq
A numeric vector specifying the frequency of each value in mX. The integer part of mFreq[i] represents the number of times the value mX[i] is counted. This vector is added to the same DataObject as the mX vector.

Remarks

This method creates a bar chart in which the height of a bar is determined by the sum of the frequencies associated with its category.

Frequency values are treated as counts. Only the integer part of each frequency value is used. If an observation has a frequency value that is missing or less than one, it is not used.

Example
animal = { "Cat", "Dog", "Iguana", "Bird", "Cat" };
freq = { 5, 4, 1, 2, 3 };
declare DataObject dobj;
dobj = DataObject.Create( "Pets" );
dobj.AddVar( "Animal", animal );
dobj.AddVar( "Frequency", freq );
BarChart.CreateWithFreq( dobj, "Animal", "Frequency" );
See Also

BarChart.Create