TextVisual: IVZTextVisual;
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 specified 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
See also: