TreeMapItem.updateBranchColors

Syntax

updateBranchColors();

Description

The updateBranchColors method refreshes colors of tree map branch.

Example

To execute this example, the page must contain the TreeMap component named treeMap (see Example of Creating the TreeMap Component). Set new color for the branch with the index 2, and set new background color for the sheet with the index 3. Change font color and size for the item with the index 4 and update its contents:

// Get chart branch with the index 2
var item1 = treeMap.getSceneItems()[2];
// Get chart leaf with the index 3
var item2 = treeMap.getSceneItems()[3];
// Get chart leaf with the index 4
var item3 = treeMap.getSceneItems()[4];
// Set new color for branch border
item1.getDomNode().style.borderColor = "rgb(255,0,0)";
// Set new background color
item2.getDomNode().style.backgroundColor = "rgb(50,200,200)";
// Get style of chart items
var itemsStyle = treeMap.getLabelsStyle();
// Change size and color of items font
itemsStyle.getFont().setColor("#FFFF00");
itemsStyle.getFont().setSize("18");
// Refresh item content
item3.updateContent();

As the result the color is changed for the branch with the index 2, leaf with the index 3, and also font of the item with the index 4 changes its color and size:

Update colors of the branch with the index 2 and the leaf with the index 3:

// Refresh branch colors
item1.updateBranchColors();
// Refresh item colors
item2.updateColors();

As the result color values for elements with the indexes 2 and 3 are refreshed and reset to default values:

See also:

TreeMapItem