Background: IGxBrush;
Background: Prognoz.Platform.Interop.Visualizators.IGxBrush;
The Background property determines brush settings for visualizer background.
To get an object for visualizer data formatting, use IVZBaseDataVisualizer.Formatter.
Executing the example requires:
An express report with the EXPRESS identifier containing a bubble tree.
The Graph.png graphic file located in the root of the C disc. Minimum image size is 200x200.
Add links to the Drawing, Express, Metabase, Visualizators system assemblies.
Sub UserProc;
Var
Metabase: IMetabase;
Analyzer: IEaxAnalyzer;
BubbleTree: IVZBaseDataVisualizer;
Formatter: IVZBaseFormatter;
Color: IGxColor;
Brush: IGxBrush;
Bitmap: IGxBitmap;
Image: IGxImage;
Graphics: IGxGraphics;
Rect: IGxRectF;
Begin
// Get repository
Metabase := MetabaseClass.Active;
// Get express report
Analyzer := Metabase.ItemById("EXPRESS").Edit As IEaxAnalyzer;
// Get bubble tree
BubbleTree := Analyzer.BubbleTree.BubbleTree As IVZBaseDataVisualizer;
// Change settings of visualizer background brush
Color := GxColor.FromName("Yellow");
Brush := New GxSolidBrush.Create(Color);
BubbleTree.Background := Brush;
// Get percentage of the 0.425 number by means of tool for data formatting
Formatter := BubbleTree.Formatter;
Formatter.FormatByParam("{0}", 0.425, "0.00%");
Debug.WriteLine("The 0.425 number expressed in percents: " + Formatter.FormatByParam("{0}", 0.425, "0.00%"));
// Enable visualizer animation
If Not BubbleTree.EnableAnimating Then
BubbleTree.EnableAnimating := True;
End If;
// Disable visualizer print mode
If BubbleTree.IsPrintMode Then
BubbleTree.IsPrintMode := False;
End If;
// There are no changes in visualizer
If BubbleTree.IsDirty Then
BubbleTree.IsDirty := False;
End If;
// Save visualizer image to file
Bitmap := BubbleTree.GetBitmap(1795, 1205, 300);
Bitmap.SaveToFile("C:\Image.jpg");
// Render visualizer to graphic object
Image := New GxImage.CreateFromFile("C:\Graph.jpg");
Graphics := GxGraphicsClass.FromImage(Image);
Rect := New GxRectF.Create(100, 100, 100, 100);
BubbleTree.Draw(Graphics, Rect, 300, True);
// Refresh report and save changes
Analyzer.RefreshAll;
(Analyzer As IMetabaseObject).Save;
End Sub UserProc;
After executing the example for bubble tree:
Background becomes yellow.
The console window displays percentage of the 0.425 number by means of data formatting tool.
Animation is enabled.
Print mode is not available.
Before closing the report it is prompted to save changes only if the are made.
Visualizer image is saved to a file by the specified path.
Visualizer is rendered to the graphic file created from the specified image.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Visualizators;
…
Public Shared Sub Main(Params: StartParams);
Var
Metabase: IMetabase;
Analyzer: IEaxAnalyzer;
BubbleTree: IVZBaseDataVisualizer;
Formatter: IVZBaseFormatter;
Color: GxColorClass = New GxColorClassClass();
Brush: IGxBrush = New GxSolidBrushClass();
Bitmap: IGxBitmap;
Image: GxImage = New GxImageClass_2();
Graphics: GxGraphicsClass = New GxGraphicsClassClass();
Gr: GxGraphics;
Rect: GxRectF = New GxRectFClass();
Begin
// Get repository
Metabase := Params.Metabase;
// Get express report
Analyzer := Metabase.ItemById["EXPRESS"].Edit() As IEaxAnalyzer;
// Get bubble tree
BubbleTree := Analyzer.BubbleTree.BubbleTree As IVZBaseDataVisualizer;
// Change settings of visualizer background brush
Color.FromName("Yellow");
BubbleTree.Background := Brush;
// Get percentage of the 0.425 number by means of tool for data formatting
Formatter := BubbleTree.Formatter;
Formatter.FormatByParam("{0}", 0.425, "0.00%");
System.Diagnostics.Debug.WriteLine
("The 0.425 number expressed in percents: " + Formatter.FormatByParam("{0}", 0.425, "0.00%"));
// Enable visualizer animation
If Not BubbleTree.EnableAnimating Then
BubbleTree.EnableAnimating := True;
End If;
// Disable visualizer print mode
If BubbleTree.IsPrintMode Then
BubbleTree.IsPrintMode := False;
End If;
// There are no changes in visualizer
If BubbleTree.IsDirty Then
BubbleTree.IsDirty := False;
End If;
// Save visualizer image to file
Bitmap := BubbleTree.GetBitmap(1795, 1205, 300);
Bitmap.SaveToFile("C:\Image.jpg");
// Render visualizer to graphic object
Image.CreateFromFile("C:\Graph.jpg");
Gr := Graphics.FromImage(Image);
Rect.Create(100, 100, 100, 100);
BubbleTree.Draw(Gr, Rect, 300, False);
// Refresh report and save changes
Analyzer.RefreshAll();
(Analyzer As IMetabaseObject).Save();
End Sub;
See also: