IVZTreeMap.TextVisual

Fore Syntax

TextVisual: IVZTextVisual;

Fore.NET Syntax

TextVisual: Prognoz.Platform.Interop.Visualizators.VZTextVisual;

Description

The TextVisual property determines text visualizer.

Fore Example

Executing the example requires that the repository contains an express report with the EXP identifier. The module containing the example should have links to the Express, Metabase and Visualizators system assemblies. The selected procedure should be called from the Main entry point.

Next, capitalize first letters of entrant strings:

// Determine custom data transformer
Class MyAdapter: object, IVZDataAdapter
    // Capitalize first letters of all strings
    Function GetData(Value: Variant): Variant;
    Var 
        str: String;
        chr: Char;
    Begin
        str := Value As String;
        // Get the first character of the line
        chr := str.Chars(0);
        // Capitalize this character
        chr := Char.ToUpper(chr);
        // Get string with capital letter
        str := chr + str.SubString(1, str.Length -1);
        Return str;
    End Function GetData;
End Class MyAdapter;

Sub UserProc;
Var
    Metabase: IMetabase; // Metabase
    EaxAnalyzer: IEaxAnalyzer; // Express report
    TreeMap: IVZTreeMap; // Tree map
    TextVisual: IVZTextVisual; // Text visualizer
    DataSourceMapping: IVZDataSourceMapping; // Settings for data mapping
    DataTransformer: IVZDataAdapter; // Data transformer  
Begin
    // Get metabase object
    Metabase := MetabaseClass.Active;
    // Get express report object
    EaxAnalyzer := Metabase.ItemById("EXP").Edit As IEaxAnalyzer;
    // Get tree map
    TreeMap := EaxAnalyzer.TreeMap.TreeMap;
    // Create new instance of text visualizer
    TextVisual := New VZTextVisual.Create;  
    // Get settings of data mapping   
    DataSourceMapping := TextVisual.TextMapping;
    // Set mapping type "Data transformer"
    DataSourceMapping.MappingType := VisualizatorDataMappingType.DataMappingTransformer;
    // Create and set custom data transformer
    DataTransformer := New MyAdapter.Create;
    DataSourceMapping.DataTransformer := DataTransformer As IVZDataAdapter;
    Debug.WriteLine("String transformation:");   
    Debug.IndentLevel := 1;
    Debug.WriteLine("Input: ""prognoz"", output: " + 
        (DataTransformer.GetData("prognoz"As String ));
    Debug.WriteLine("Input: ""tree map"", output: " + 
        (DataTransformer.GetData("tree map"As String ));  
    // Set visualizer used to determine bubble tree element size
    TreeMap.TextVisual := TextVisual;
End Sub UserProc;

After executing the example, the custom data transformer is created, used to capitalize first letters of entrant strings:

String transformation:

    Input: "prognoz", output: Prognoz

    Input: "tree map", output: Tree map

Fore.NET Example

Executing the example requires that the repository contains an express report with the EXP identifier. The examples below are inserted into the Program.NET assembly module. The Express, Metabase and Visualizators assemblies should be imported to this module from the Prognoz.Platform.Interop system assembly.

First, implement the IVZDataAdapter interface an determine the MyAdapter class with all required open methods:

// Determine custom data transformer
Public Class MyAdapter: object, IVZDataAdapter
    // Capitalize first letters of all strings
    Public Function GetData(Value: object): object;
    Var 
        str: String;
        chr: Char;
    Begin
        str := Value As String;
        // Get the first character of the line
        chr := str.Chars[0];
        // Capitalize this character
        chr := Char.ToUpper(chr);
        // Get string with capital letter
        str := chr + str.SubString(1, str.Length -1);
        Return str;
    End Function GetData;
    // Function used to save data to XML file
    Public Function SaveToXml(): string;
    Begin
        Return Null
    End Function SaveToXml;
    
    // Function used to read data as XML file
    Public Sub LoadFromXml(Result: string);
    Begin
    End Sub LoadFromXml;    
End Class MyAdapter;

After executing the example, the custom data transformer is created, used to capitalize first letters of entrant strings:

Next, transform the set of source strings with this transformer and replace the Main procedure in the program module with the following code:

Public Shared Sub Main(Params: StartParams);
Var
    Metabase: IMetabase; // Metabase
    EaxAnalyzer: IEaxAnalyzer; // Express report
    TreeMap: IVZTreeMap; // Tree map
    TextVisual: IVZTextVisual; // Text visualizer
    DataSourceMapping: IVZDataSourceMapping; // Settings for data mapping
    DataTransformer: IVZDataAdapter; // Data transformer 
Begin
    // Get metabase object
    Metabase := Params.Metabase;
    // Get express report object
    EaxAnalyzer := Metabase.ItemById["EXP"].Edit() As IEaxAnalyzer;
    // Get tree map
    TreeMap := EaxAnalyzer.TreeMap.TreeMap;
    // Create new instance of text visualizer
    TextVisual := New VZTextVisual.Create();    
    // Get settings for data mapping   
    DataSourceMapping := TextVisual.TextMapping;
    // Set mapping type "Data transformer"
    DataSourceMapping.MappingType := VisualizatorDataMappingType.vdmtDataMappingTransformer;
    // Create and set custom data transformer
    DataTransformer := New MyAdapter();
    DataSourceMapping.DataTransformer := DataTransformer As IVZDataAdapter;
    System.Diagnostics.Debug.WriteLine("String transformation:");
    System.Diagnostics.Debug.IndentLevel := 1;
    System.Diagnostics.Debug.WriteLine("Input: ""prognoz"", output: " +
        (DataTransformer.GetData("prognoz"As String ));
    System.Diagnostics.Debug.WriteLine("Input: ""tree map"", output: " +
        (DataTransformer.GetData("tree map"As String ));
    // Set visualizer used to determine bubble tree element size
    TreeMap.TextVisual := TextVisual As VZTextVisual;
End Sub;

The result of the executed example is the same as that, executed for Fore language.

See also:

IVZTreeMap