Creating a Visualizer Form

To create a visualize form, execute the following operations:

  1. Create a form with the PluginViewForm identifier. This form should inherit from the AdhocUserViewForm class.

  2. Place the Label component with the Label_Plugin_Caption identifier at the upper part of the form. Select this component and in the object inspector on the Properties tab delete values of the Text property; set the AutoSize property to True.

  3. Add the UiErAnalyzer component with the UiErAnalyzer1 identifier on the form.

  4. Add the ErAnalyzerDimPanel component with the ErAnalyzerDimPanel1 identifier to the left part of the form. Select this component and in the object inspector on the Properties tab select the UiErAnalyzer1 value for the Object property.

  5. Add the ChartBox component with the ChartBox1 identifier to the right part of the form. Select this component and in the object inspector Select the UiErAnalyzer1 value for the Source property on the Properties tab. The form should look as follows:

  1. Add links to the Adhoc, Chart, Metabase, and Xml system assemblies.

  2. Set form code:

Public Class PluginViewFormForm: AdhocUserViewForm
    UiErAnalyzer1: UiErAnalyzer;
    ChartBox1: ChartBox;
    ErAnalyzerDimPanel1: ErAnalyzerDimPanel;
    Label_Plugin_Caption: Label;
    
    { Function for getting types of supported data sources.
      Implementation of AdhocUserViewForm.SupportedSource}

    Function get_SupportedSource: Array Of Integer;
    Var
        SourcesKeys: Array Of Integer;
    Begin
        SourcesKeys := New Integer[1];
        SourcesKeys[0] := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
        return sourcesKeys;
    end Function get_SupportedSource;
        
    { Procedure of setting plugin data source.
      Implementation of AdhocUserViewForm.Source}

    Sub set_Source(s: IAdhocDataSourceObject);
    Var
        Analyzer: IEaxAnalyzer;
    Begin
        SourceValue := s;
        Analyzer := SourceValue.GetSourceObject As IEaxAnalyzer;
        UiErAnalyzer1.ErAnalyzer := SourceValue.GetSourceObject As IEaxAnalyzer;
        UiErAnalyzer1.ErAnalyzer.Chart.Active := True;
        UiErAnalyzer1.Active := True;
    End Sub set_Source;

    { Procedure of saving plugin settings.
      Implementation of AdhocUserViewForm.SaveSettings}

    Sub SaveSettings(xml: Variant);
    Var
        el: IXmlDomElement;
    Begin
        el := xml As IXmlDomElement;
        el.setAttribute("txt", Label_Plugin_Caption.Text);
    End Sub SaveSettings;

    { Procedure of loading plugin settings.
      Implementation of AdhocUserViewForm.LoadSettings}

    Sub LoadSettings(xml: Variant);
    Var
        el: IXmlDomElement;
    Begin
        el := xml As IXmlDomElement;
        Label_Plugin_Caption.Text := el.getAttribute("txt"As string;
    End Sub LoadSettings;
    
    { Custom procedure for setting plugin caption.
      It is used to interact with side panel tab}

    Public Sub SetLabelText(val: string);
    Begin
        Label_Plugin_Caption.Text := val;
    End Sub SetLabelText;
    
    { Custom function of getting plugin caption.
      It is used to interact with side panel tab}

    Public Function GetLabelText: string;
    Begin
        Return Label_Plugin_Caption.Text;
    End Function GetLabelText;

End Class PluginViewFormForm;

See also:

Creating a Plugin | AdhocUserViewForm