BubbleTreeBox.getLegends

Syntax

getLegends();

Description

The getLegends method returns object that contains bubble tree legends.

Comments

The method returns a JSON object whose properties (Legend0, Legend1 and so on) contain bubble tree legends.

Example

Executing the example requires that the HTML page contains the BubbleTreeBox component named bubbleTreeBox (see Example of Creating the BubbleTreeBox Component). Show size legend if settings of data mapping with tree elements' sizes are defined:

// Get size legend
var sizeLegend = bubbleTreeBox.getLegends()["Legend1"];
// Determine if the size legend is available
if (bubbleTreeBox.getSizeVisual() & sizeLegend) {
    // Show the size legend
    sizeLegend.setIsVisible(True);
    // Set legend size
    sizeLegend.setSize(180, 75);
} else {
    if (sizeLegend) {
        console.log("Size legend is available.")
    } else {
        console.log("Size legend is not available.")
    };    
    console.log("Settings of data mappings with tree elements' sizes are not defined.");
};

If bubble tree size legend is unavailable, or settings for data mapping with tree elements' sizes are not defined, after the example execution the browser console displays appropriate warnings. If these settings are defined the size legend is shown.

See also:

BubbleTreeBox