calculateBranchColor(color1: String, color2: String, level: Number);
color1. Color value. It is set in the following format: #RRGGBB.
color2. Value of the second. It is set in the following format: #RRGGBB.
level. Title level. Determines color propoptions. When the value is set to six, only the second color is used; when the value is zero, only the first color is used.
The calculateBranchColor method calculates value of branch title color based on specified colors.
This method returns a String-type value.
To execute this example, the page must contain the TreeMap component named treeMap (see Example of Creating the TreeMap Component). Calculate new color of the item border, item background color and item text font color:
// Get chart item with the index 3 var item = treeMap.getSceneItems()[3]; // Create new colors var color1 = "#252525"; var color2 = "#898900"; // Calculate and show color for branch title BrColor = item.calculateBranchColor(color1, color2, 1) console.log("Calculated color for title of first level branch: " + BrColor)
After the example execution the browser console shows new calculates values of branch title color:
Calculated color for title of first level branch: "#36361f"
See also: