IVZLegends.Add

Syntax

Add(Value: IVZLegendBase): Integer;

Parameters

Value. Legend added to collection.

Description

The Add method adds the selected legend to visualizer legend collection.

Comments

This method returns index of the legend added to the collection.

To display the legend in visualizer, it is necessary to specify values for its properties. For example, the following properties are required for a color legend:

Example

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 Drawing, Express, Metabase and Visualizators system assemblies. The specified procedure should be called from the Main entry point.

Before executing this example, the bubble tree looks as shown on the IVZBubbleTree interface description page. Then create a legend with intervals, that does not reduce bubble tree workspace. Select values of appropriate properties of color legend for all required properties of bubble tree workspace, set title and footer. Then add the legend to the bubble chart:

Sub UserProc;
Var
    Metabase: IMetabase; // Metabase
    Analyzer: IEaxAnalyzer; // Express report
    BubbleTree: IVZBubbleTree; // Bubble tree
    ColorLegend: IVZColorLegendBase; // Color legend
    IntervalsLegend: IVZIntervalsLegend; // Legend with intervals
Begin
    // Get metabase object
    Metabase := MetabaseClass.Active;
    // Get express report object
    Analyzer := Metabase.ItemById("EXP").Edit As IEaxAnalyzer;
    // Get bubble tree
    BubbleTree := Analyzer.BubbleTree.BubbleTree;
    // Get color legend of bubble tree
    ColorLegend := BubbleTree.Legends.Item(0As IVZColorLegendBase;
    
    // Create new legend
    IntervalsLegend := New VZIntervalsLegend.Create;
    // Set color scale
    IntervalsLegend.Scale := ColorLegend.Scale;
    // Set formats of labels for scale intervals
    IntervalsLegend.BetweenFormat := ColorLegend.BetweenFormat;
    IntervalsLegend.GreaterFormat := ColorLegend.GreaterFormat;
    IntervalsLegend.LessFormat := ColorLegend.LessFormat;
    // Specify legend style
    IntervalsLegend.Style := ColorLegend.Style;
    // Select style for the no data bubble
    IntervalsLegend.NoDataText := ColorLegend.NoDataText;
    // Set legend title
    IntervalsLegend.Header := ColorLegend.Header;
    IntervalsLegend.Header.Text := "Title";
    
    // Set legend footer
    IntervalsLegend.Footer := ColorLegend.Header;
    IntervalsLegend.Footer.Text := "Footer";
    IntervalsLegend.Footer.Style.Alignment := GxStringAlignment.Near;
    
    // Legend does not reduce bubble tree area
    IntervalsLegend.IsOverlap := True;
    
    // Add the legend to bubble chart
    BubbleTree.Legends.Add(IntervalsLegend);
    Debug.WriteLine("Total number of legends: " + BubbleTree.Legends.Count.ToString);
    
    // Save changes, made in express report
    (Analyzer As IMetabaseObject).Save;
End Sub UserProc;

After executing the example, the legend with intervals is created that does not reduce bubble tree workspace. The values of appropriate properties of color legend for all required properties of the bubble tree workspace are selected, legend title and footer are set as well. Then the legend is added to the bubble chart:

The development environment console window shows total number of legends in the bubble tree:

Total number of legends: 2

See also:

IVZLegends