TextVisual: IVZTextVisual;
The TextVisual property determines text visualizer.
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 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
TreeMap: IVZTreeMap; // Tree map
TextVisual: IVZTextVisual; // Text visualizator
DataSourceMapping: IVZDataSourceMapping; // Settings used to correlate data
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
See also: