SpreadJS Documentation > Developer's Guide > Customizing the Appearance > Using Conditional Formatting > Using the Average Rule |
The average rule checks for values above or below the average.
The following image displays an example of the average rule.
This example creates an average rule.
JavaScript |
Copy Code
|
---|---|
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 GcSpread.Sheets.Style(); style.backColor = "red"; style.borderLeft =new GcSpread.Sheets.LineBorder("blue"); style.borderTop = new GcSpread.Sheets.LineBorder("blue"); style.borderRight = new GcSpread.Sheets.LineBorder("blue"); style.borderBottom = new GcSpread.Sheets.LineBorder("blue"); activeSheet.getConditionalFormats().addAverageRule( GcSpread.Sheets.AverageConditionType.Above,style,[new GcSpread.Sheets.Range(0, 0, 10, 3)]); |