SizeVisual: IVZNumericVisual;
SizeVisual: Prognoz.Platform.Interop.Visualizators.VZNumericVisual;
The SizeVisual property determines visualizer used to set size of tree map child items.
Executing the example requires that the repository contains an express report with the EXP identifier. To enable visualizer used to set size of map tree children, open this express report and go to the Selection tab on the side panel. Then open the Metrics dimension tab and click the Size button, select one of the items available in the list:
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 as much as 20 times:
// Determine custom data transformer
Class MyAdapter: object, IVZDataAdapter
// Input value is to be increased 20-fold
Function GetData(Value: Variant): Variant;
Begin
Return Value * 20
End Function GetData;
End Class MyAdapter;
Sub UserProc;
Var
Metabase: IMetabase; // Metabase
EaxAnalyzer: IEaxAnalyzer; // Express report
TreeMap: IVZTreeMap; // Tree map
SizeVisual: IVZNumericVisual; // Visualizer of bubble chart elements' size
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;
// Get visualizer of map tree elements' size
SizeVisual := TreeMap.SizeVisual;
// Get settings for data mapping
DataSourceMapping := SizeVisual.NumericMapping;
// 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("Data transformation:");
Debug.IndentLevel := 1;
Debug.WriteLine("Input: -0.05, output: " +
((DataTransformer.GetData(-0.05)) As Double).ToString);
Debug.WriteLine("Input: 0, output: " +
((DataTransformer.GetData(0)) As Double).ToString);
Debug.WriteLine("Input: 0.05, output: " +
((DataTransformer.GetData(0.05)) As Double).ToString);
Debug.WriteLine("Input: 5, output: " +
((DataTransformer.GetData(5)) As Double).ToString);
Debug.WriteLine("Input: 1000, output: " +
((DataTransformer.GetData(1000)) As Double).ToString);
// Set visualizer used to determine bubble tree element size
TreeMap.SizeVisual := SizeVisual;
End Sub UserProc;
After executing the example, the custom transformer is created used to increase output value as much as 20 times, the development environment console window shows results of number transformation: -0.05, 0, 0.05, 5 and 1000:
Data transformation:
Input: -0.05, ouput: -1
Input: 0, output: 0
Input: 0.05, output: 1
Input: 5, output: 100
Input: 1000, output: 20000
Executing the example requires that the repository contains an express report with the EXP identifier. To enable visualizer used to set size of map tree children, open this express report and go to the Selection tab on the side panel. Then open the Metrics dimension tab and click the Size button, select one of the items available in the list:
The selected procedure is the Main entry point in 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
// Input value is to be increased 20-fold
Public Function GetData(Value: object): object;
Var
Result: double;
Begin
Result := double.Parse(Value.ToString()) * 20;
Return Result As Object
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 increase input value 20-fold.
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
SizeVisual: IVZNumericVisual; // Visualizer of tree elements' size
DataSourceMapping: IVZDataSourceMapping; // Settings for 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;
// Get visualizer used to set size of tree elements
SizeVisual := TreeMap.SizeVisual;
// Get settings for data mapping
DataSourceMapping := SizeVisual.NumericMapping;
// 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("Data transformation:");
System.Diagnostics.Debug.IndentLevel := 1;
System.Diagnostics.Debug.WriteLine("Input: -0.05, output: " +
((DataTransformer.GetData(-0.05)) As Double).ToString());
System.Diagnostics.Debug.WriteLine("Input: 0, output: " +
((DataTransformer.GetData(0)) As Double).ToString());
System.Diagnostics.Debug.WriteLine("Input: 0.05, output: " +
((DataTransformer.GetData(0.05)) As Double).ToString());
System.Diagnostics.Debug.WriteLine("Input: 5, output: " +
((DataTransformer.GetData(5)) As Double).ToString());
System.Diagnostics.Debug.WriteLine("Input: 1000, output: " +
((DataTransformer.GetData(1000)) As Double).ToString());
// Determine visualizer used to set size of tree elements
TreeMap.SizeVisual := SizeVisual As VZNumericVisual;
End Sub;
The result of the executed example is the same as that, executed for Fore language.
See also: