void GetVars( int nRole, Matrix mVarNames )
int nRole
A predefined constant specifying the type of variables to retrieve. The valid values are ROLE_X, ROLE_Y, ROLE_Z, ROLE_LABEL,
ROLE_FREQ, ROLE_GROUP, ROLE_ID, and ROLE_ANY.
Matrix mVarNames
Upon return, contains a column vector of the names of the variables in the specified role in the plot.
This method retrieves the names of the variables used by the plot in a specific role. If there are no variables being used in the specified role, mVarNames will be empty.
If nRole is ROLE_X, ROLE_Y, or ROLE_Z, the mVarNames matrix contains the names of the variables on the corresponding axis.
If nRole is ROLE_LABEL, the mVarNames matrix contains the name of the label variable.
If nRole is ROLE_FREQ, the mVarNames matrix contains the name of the frequency variable.
If nRole is ROLE_GROUP, the mVarNames matrix contains the names of the group variables.
If nRole is ROLE_ID, the mVarNames matrix contains the names of the ID variables.
If nRole is ROLE_ANY, the mVarNames matrix contains the names of any variables used by the plot in any role.
This method is most often used by modules that need to perform a computation based on variables in a plot that satisfy certain roles.
declare DataObject dobjAir;
dobjAir = DataObject.CreateFromFile( "air" );
dobjAir.SetNominal("day");
declare LinePlot line;
line = LinePlot.CreateWithGroup(dobjAir, "hour", "co", "day");
line.SetObsLabelVar("wind");
colors = RED // YELLOW // GREEN // BLUE // MAGENTA // WHITE // BLACK;
run ColorCodeLinesByGroups( line, "day", colors );
run PrintVariables(line);
start PrintVariables(Plot plot);
roleName = {"X" "Y" "Z" "Label" "Frequency" "Group" "ID"};
role = ROLE_X || ROLE_Y || ROLE_Z || ROLE_LABEL ||
ROLE_FREQ || ROLE_GROUP || ROLE_ID;
reset noname;
print "The variables in this plot are";
do i = 1 to ncol(role);
plot.GetVars( role[i], mVarNames );
if ncol(mVarNames)>0 then
print (roleName[i]) mVarNames;
end;
finish;
BarChart.CreateWithFreq
LinePlot.CreateWithGroup
Plot.SetObsLabelVar
PolygonPlot.Create