Spread.Sheets Documentation
addAverageRule Method
GC.Spread.Sheets.ConditionalFormatting Namespace > ConditionalFormats type : addAverageRule Method
The average condition type.
The style that is applied to the cell when the condition is met.
The cell ranges where the rule is applied whose item type is GC.Spread.Sheets.Range.
Adds an average rule to the rule collection.
Syntax
var instance = new GC.Spread.Sheets.ConditionalFormatting.ConditionalFormats(worksheet);
var value; // Type: object
value = instance.addAverageRule(type, style, ranges);
function addAverageRule( 
   type : AverageConditionType,
   style : Style,
   ranges : undefined
) : object;

Parameters

type
The average condition type.
style
The style that is applied to the cell when the condition is met.
ranges
The cell ranges where the rule is applied whose item type is GC.Spread.Sheets.Range.

Return Value

The average rule added to the rule collection.
Example
This example uses the addAverageRule method.
activeSheet.setValue(0,0, 1,3);
activeSheet.setValue(1,0, 50,3);
activeSheet.setValue(2,0, 100,3);
activeSheet.setValue(3,0, 2,3);
activeSheet.setValue(4,0, 60,3);
activeSheet.setValue(5,0, 90,3);
activeSheet.setValue(6,0, 3,3);
activeSheet.setValue(7,0, 40,3);
activeSheet.setValue(8,0, 70,3);
activeSheet.setValue(9,0, 5,3);
activeSheet.setValue(10,0, 35,3);
 var style = new GC.Spread.Sheets.Style();
style.backColor = "red";
style.borderLeft =new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
style.borderTop = new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
style.borderRight = new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
style.borderBottom = new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
activeSheet.conditionalFormats.addAverageRule(GC.Spread.Sheets.ConditionalFormatting.AverageConditionType.above,style,[new GC.Spread.Sheets.Range(0, 0, 10, 3)]);
See Also

Reference

ConditionalFormats type