Spread.Sheets Documentation
getIcon Method
GC.Spread.Sheets.ConditionalFormatting Namespace > IconSetRule class : getIcon Method
The icon set type.
The icon index. returns {object} An object that contains the image's URL string, the offset, and width and height. If the user wants to customize the icon for IconSet, it returns the image URL string.
Gets the icon based on the specific iconSetType and iconIndex objects.
Syntax
var value; // Type: any
value = GC.Spread.Sheets.ConditionalFormatting.IconSetRule.getIcon(iconSetType, iconIndex);
function getIcon( 
   iconSetType : IconSetType,
   iconIndex : number
) : any;

Parameters

iconSetType
The icon set type.
iconIndex
The icon index. returns {object} An object that contains the image's URL string, the offset, and width and height. If the user wants to customize the icon for IconSet, it returns the image URL string.
Example
This example returns the icons for an icon set rule.
activeSheet.setValue(0,0,1,3);
activeSheet.setValue(1,0,15,3);
activeSheet.setValue(2,0,25,3);
activeSheet.setValue(3,0,-1,3);

var base = GC.Spread.Sheets.ConditionalFormatting.IconSetRule.getIcon;
GC.Spread.Sheets.ConditionalFormatting.IconSetRule.getIcon = function (iconSetType, iconIndex) {
                     var icon = base.apply(this, arguments);
                     if (iconSetType === GC.Spread.Sheets.ConditionalFormatting.IconSetType.threeArrowsColored) {
                         if (iconIndex === 0) {
                             return "images/Star2.png";
                         } else if (iconIndex === 1){
                             return "images/Rating4.png";
                         } else if (iconIndex === 2) {
                             return "images/Box4.png";
                         }
                     }
                     return icon;
                 };

var iconSetRule = new GC.Spread.Sheets.ConditionalFormatting.IconSetRule();
iconSetRule.ranges([new GC.Spread.Sheets.Range(0,0,4,1)]);
iconSetRule.iconSetType(GC.Spread.Sheets.ConditionalFormatting.IconSetType.threeArrowsColored);
var iconCriteria = iconSetRule.iconCriteria();
iconCriteria[0] = new GC.Spread.Sheets.ConditionalFormatting.IconCriterion(true, GC.Spread.Sheets.ConditionalFormatting.IconValueType.number, 1);
iconCriteria[1] = new GC.Spread.Sheets.ConditionalFormatting.IconCriterion(true, GC.Spread.Sheets.ConditionalFormatting.IconValueType.number, 10);
iconCriteria[2] = new GC.Spread.Sheets.ConditionalFormatting.IconCriterion(true, GC.Spread.Sheets.ConditionalFormatting.IconValueType.number, 20);
iconSetRule.reverseIconOrder(false);
iconSetRule.showIconOnly(false);
activeSheet.conditionalFormats.addRule(iconSetRule);
See Also

Reference

IconSetRule class