AddVariableStub(Stub: IVariableStub);
Stub. Variable that is used on calculating the principal component analysis.
The AddVariableStub method adds a variable, that is used on calculating the principal component analysis, into the component.
Executing the example requires a form, a button named Button1 on the form and the PCABox component named PCABox1. The component is connected to the modeling container that contains variables with the X1 and X2 identifiers.
The example is a handler of the OnShow event for the form.
Add links to the Cubes, ExtCtrls, Forms, Metabase, and Ms system assemblies.
Sub TsetFormOnShow(Sender: Object; Args: IEventArgs);
Var
MB: IMetabase;
MS, VarObj: IMetabaseObjectDescriptor;
Begin
MB := MetabaseClass.Active;
MS := MB.ItemById("CONT_MODEL");
PCABox1.ModelSpace := MS.Bind As IMsModelSpace;
VarObj := MB.ItemByIdNamespace("X1", (MS As IMetabaseObject).Key);
PCABox1.AddVariableStub(VarObj.Bind As IVariableStub);
VarObj := MB.ItemByIdNamespace("X2", (MS As IMetabaseObject).Key);
PCABox1.AddVariableStub(VarObj.Bind As IVariableStub);
End Sub TestFormOnShow;
After executing the example, on displaying the form, the PCABox1 component is connected to the CONT_MODEL modeling container. The X1 and X2 modeling variables are loaded to the list of component variables. These variables are used to automatically calculate the principal component analysis.
See also: