HeightVisual: IVZNumericVisual;
HeightVisual: Prognoz.Platform.Interop.Visualizators.VZNumericVisual;
The HeightVisual property determines visualizer used to set the height of tree map children.
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.
Transform a set of numbers by the custom transformer used to increase the input value five-fold:
// Determine custom data transformer
Class MyAdapter: object, IVZDataAdapter
// Input value is to be increased as much as five times
Function GetData(Value: Variant): Variant;
Begin
Return Value * 5
End Function GetData;
End Class MyAdapter;
Sub UserProc;
Var
Metabase: IMetabase; // Metabase
EaxAnalyzer: IEaxAnalyzer; // Express report
TreeMap: IVZTreeMap; // Tree map
HeightVisual: IVZNumericVisual; // Visualizator of bubble chart elements height
DataSourceMapping: IVZDataSourceMapping; // Settings of 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 visualizer object
HeightVisual := New VZNumericVisual.Create;
// Get settings of data mapping
DataSourceMapping := HeightVisual.NumericMapping;
// Set mapping type "Data transformer"
DataSourceMapping.MappingType := VisualizatorDataMappingType.DataMappingTransformer;
// Create and set custom data transformer
DataTransformer := New MyAdapter.Create;
DataSourceMapping.DataTransformer := DataTransformer;
Debug.WriteLine("Data transformation:");
Debug.IndentLevel := 1;
Debug.WriteLine("Input: 1, output: " +
((DataTransformer.GetData(1)) As Double).ToString);
Debug.WriteLine("Input: 5, output: " +
((DataTransformer.GetData(5)) As Double).ToString);
Debug.WriteLine("Input: 30, output: " +
((DataTransformer.GetData(30)) As Double).ToString);
// Set visualizer used to determine tree elements height
TreeMap.HeightVisual := HeightVisual;
End Sub UserProc;
After executing the example, the custom transformer increasing output value five fold is created, the development environment console window shows results of transformation for numbers 1, 5 and 30:
Data transformation:
Input: 1, output: 5
Input: 5, output: 25
Input: 30, output: 150
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 by determining the MyAdapter class with open property:
// Determine custom data transformer
Public Class MyAdapter: object, IVZDataAdapter
Value: String;
// Input value is to be increased as much as five times
Public Function GetData(Value: object): object;
Var
Result: double;
Begin
Result := double.Parse(Value.ToString()) * 5;
Return Result As Object
End Function GetData;
//Redetermine the Id open property of the IVZDataAdapter interface
Public Property Id: String
Get
Begin
Return value;
End Get
Set
Begin
Value := "";
End Set
End Property Id;
End Class MyAdapter;
After executing the example, the custom data transformer is created used to increase input value as much as five times.
Now transform a set of source numbers by this transformer, and change 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
HeightVisual: IVZNumericVisual; // Visualizator of bubble chart elements height
DataSourceMapping: IVZDataSourceMapping; // Settings of data mapping
DataTransformer: IVZDataAdapter; // Data transformer
Begin
// Get metabase object
Metabase := Params.Metabase;
// Open express report
EaxAnalyzer := Metabase.ItemById["EXP"].Edit() As IEaxAnalyzer;
// Get tree map
TreeMap := EaxAnalyzer.TreeMap.TreeMap;
// Create new visualizer object
HeightVisual := New VZNumericVisual.Create();
// Get settings of data mapping
DataSourceMapping := HeightVisual.NumericMapping;
// 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("Data transformation:");
System.Diagnostics.Debug.IndentLevel := 1;
System.Diagnostics.Debug.WriteLine("Input: 1, output: " +
((DataTransformer.GetData(1)) As Double).ToString());
System.Diagnostics.Debug.WriteLine("Input: 5, output: " +
((DataTransformer.GetData(5)) As Double).ToString());
System.Diagnostics.Debug.WriteLine("Input: 30, output: " +
((DataTransformer.GetData(30)) As Double).ToString());
// Set visualizer used to determine tree elements height
TreeMap.HeightVisual := HeightVisual As VZNumericVisual;
End Sub;
The result of the executed example is the same as that, executed for Fore language.
See also: