0)
{
return this.blendColors(ZERO_COLOR, MAX_COLOR, 1 - (Math.abs(change) / this._maxAbsoluteChange));
}
return ZERO_COLOR;
}
/**
* Determines the blended color between two separate colors using a range from 0 to 1.
*/
private function blendColors(color1:uint, color2:uint, percent:Number = 0.5):uint
{
var remaining:Number = 1 - percent;
var red1:uint = (color1 >> 16) & 0xff;
var green1:uint = (color1 >> 8) & 0xff;
var blue1:uint = color1 & 0xff;
var red2:uint = (color2 >> 16) & 0xff;
var green2:uint = (color2 >> 8) & 0xff;
var blue2:uint = color2 & 0xff;
color1 = ((red1 * percent) << 16) + ((green1 * percent) << 8) + blue1 * percent;
color2 = ((red2 * remaining) << 16) + ((green2 * remaining) << 8) + blue2 * remaining;
return color1 + color2;
}
/**
* For each item, determines the tooltip text.
*/
private function itemToToolTip(item:Object):String
{
//one tooltip for branches and one for leaves
if(this.treeMap.dataDescriptor.isBranch(item))
{
return null;
}
var capInBillions:Number = Number(item.@marketCap) / 1000000000;
return "Value: " + this.formatter.format(item.@value) + "\n" +
"Change: " + item.@change + "%\n" +
"Market Cap: $" + capInBillions + "B";
}
]]>