TextVisual: IVZTextVisual;
TextVisual: Prognoz.Platform.Interop.Visualizators.VZTextVisual;
The TextVisual property determines text visualizer.
Executing the example requires that the repository contains an express report with the EXPRES identifier. The express report should have set up displaying of the Bubble Tree visualizer, for which the Color metric should be selected. The module containing the example should have links to the Dimension, 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
EaxBubbleTree: IEaxBubbleTree; //Bubble tree
TextVisual: IVZTextVisual; // Text visualizator
DataSourceMapping: IVZDataSourceMapping; // Settings used for data mapping
DataTransformer: IVZDataAdapter; // Data transformer
Begin
// Get metabase object
Metabase := MetabaseClass.Active;
// Get express report object
EaxAnalyzer := Metabase.ItemById("EXPRES").Edit As IEaxAnalyzer;
EaxBubbleTree := EaxAnalyzer.BubbleTree;
//Set selection for the Value metric
EaxBubbleTree.IndicatorSelection(EaxBubbleTreeIndicators.Color).CopyTo(EaxBubbleTree.IndicatorSelection(EaxBubbleTreeIndicators.Value), True);
// Get text visualizator
TextVisual := EaxBubbleTree.BubbleTree.TextVisual;
// Get settings used for 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;
Debug.WriteLine("String transformation:");
Debug.IndentLevel := 1;
Debug.WriteLine("Input: ""prognoz"", output: " +
(DataTransformer.GetData("prognoz") As String ));
Debug.WriteLine("Input: ""bubble tree"", output: " +
(DataTransformer.GetData("bubble tree") As String ));
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: "bubble tree", output: Bubble tree
Executing the example requires that the repository contains an express report with the EXP identifier. The Bubble Tree visualizer displaying should be set up in the express report. The examples below are inserted into the Program.NET assembly module. The Dimension, 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 and properties:
// Determine custom data transformer
Public Class MyAdapter: object, IVZDataAdapter
s: String;
// 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;
//Redetermine the Id open property of the IVZDataAdapter interface
Public Property Id: String
Get
Begin
Return s;
End Get
Set
Begin
s := "";
End Set
End Property Id;
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
EaxBubbleTree: IEaxBubbleTree; //Bubble tree
TextVisual: IVZTextVisual; // Text visualizator
DataSourceMapping: IVZDataSourceMapping; // Settings for data mapping
DataTransformer: IVZDataAdapter; // Data transformer
Begin
// Get metabase object
Metabase := Params.Metabase;
// Get express report object
EaxAnalyzer := Metabase.ItemById["EXPRES"].Edit() As IEaxAnalyzer;
EaxBubbleTree := EaxAnalyzer.BubbleTree;
//Set selection for the Value metric
EaxBubbleTree.IndicatorSelection[EaxBubbleTreeIndicators.ebtiColor As Integer].CopyTo(EaxBubbleTree.IndicatorSelection[EaxBubbleTreeIndicators.ebtiValue As Integer], True);
// Get text visualizator
TextVisual := EaxBubbleTree.BubbleTree.TextVisual;
// Get data mapping settings
DataSourceMapping := TextVisual.TextMapping;
// Set mapping type "Data transformer"
DataSourceMapping.MappingType := VisualizatorDataMappingType.vdmtDataMappingTransformer;
// Create and set custom data transformer
DataTransformer := New MyAdapter();
DataSourceMapping.DataTransformer := DataTransformer;
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: ""bubble tree"", output: " +
(DataTransformer.GetData("bubble tree") As String ));
End Sub;
The result of the executed example is the same as that, executed for Fore language.
See also: