1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
/**
* Called before drawing the legend item.
*
* @param lerh
* LegendEntryRenderingHints
* @param bounds
* Bounds
* @param icsc
* IChartScriptContext
* @since Version 2.2.0
*/
function beforeDrawLegendItem( lerh, bounds, icsc )
{
Hex2RGB = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("Hex2RGB");
mColor = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("mCode");
value = lerh.getLabel().getCaption().getValue().toLowerCase();
if (mColor!=null && mColor.containsKey(value)){
rgb = Hex2RGB((String)(mColor.get(value)));
lerh.getFill().set(rgb[0],rgb[1],rgb[2]);
}
else{
lerh.getFill().set(170,170,170);
}
} |