[]
        
(Showing Draft Content)

GC.Spread.Sheets.ConditionalFormatting.ScaleRule

Class: ScaleRule

Sheets.ConditionalFormatting.ScaleRule

Hierarchy

Table of contents

Constructors

Methods

Constructors

constructor

new ScaleRule(ruleType, minType?, minValue?, minColor?, midType?, midValue?, midColor?, maxType?, maxValue?, maxColor?, ranges?)

Represents a scale conditional rule.

@extends GC.Spread.Sheets.ConditionalFormatting.ConditionRuleBase

example

var scale = new GC.Spread.Sheets.ConditionalFormatting.ScaleRule();
scale.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.threeScaleRule);
scale.midColor("red");
scale.midType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.midValue(50);
scale.maxColor("blue");
scale.maxType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.maxValue(100);
scale.minColor("yellow");
scale.minType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.minValue(10);
scale.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 3)]);
activeSheet.conditionalFormats.addRule(scale);
activeSheet.setValue(0,0, 1,3);
activeSheet.setValue(1,0, 50,3);
activeSheet.setValue(2,0, 100,3);

Parameters

Name Type Description
ruleType RuleType The rule type.
minType? ScaleValueType The minimum scale type.
minValue? number The minimum scale value.
minColor? string The minimum scale color.
midType? ScaleValueType The midpoint scale type.
midValue? number The midpoint scale value.
midColor? string The midpoint scale color.
maxType? ScaleValueType The maximum scale type.
maxValue? number The maximum scale value.
maxColor? string The maximum scale color.
ranges? Range[] The ranges.

Overrides

ConditionRuleBase.constructor

Methods

condition

condition(value?): any

Gets or sets the base condition of the rule.

Parameters

Name Type Description
value? Condition The base condition of the rule.

Returns

any

If no value is set, returns the base condition of the rule; otherwise, returns the condition rule.

Inherited from

ConditionRuleBase.condition


contains

contains(row, column): boolean

Determines whether the range of cells contains the cell at the specified row and column.

Parameters

Name Type Description
row number The row index.
column number The column index.

Returns

boolean

true if the range of cells contains the cell at the specified row and column; otherwise, false.

Inherited from

ConditionRuleBase.contains


createCondition

createCondition(): Condition

Creates a condition for the rule.

Returns

Condition

The condition.

Overrides

ConditionRuleBase.createCondition


evaluate

evaluate(evaluator, baseRow, baseColumn, actual): any

Returns a specified value of the rule if the cell satisfies the condition.

Parameters

Name Type Description
evaluator Object The evaluator.
baseRow number The row index.
baseColumn number The column index.
actual Object The actual value object for evaluation.

Returns

any

A specified value of the rule if the cell satisfies the condition.

Overrides

ConditionRuleBase.evaluate


getExpected

getExpected(): Style

Gets the style of the base rule.

Returns

Style

Inherited from

ConditionRuleBase.getExpected


intersects

intersects(row, column, rowCount, columnCount): boolean

Specifies whether the range for this rule intersects another range.

Parameters

Name Type Description
row number The row index.
column number The column index.
rowCount number The number of rows.
columnCount number The number of columns.

Returns

boolean

true if the range for this rule intersects another range; otherwise, false.

Inherited from

ConditionRuleBase.intersects


isScaleRule

isScaleRule(): boolean

Specifies whether this rule is a scale rule.

Returns

boolean

true if this rule is a scale rule; otherwise, false.

Inherited from

ConditionRuleBase.isScaleRule


maxColor

maxColor(value?): any

Gets or sets the maximum color scale.

example

var rule = new GC.Spread.Sheets.ConditionalFormatting.ScaleRule();
rule.ranges([new GC.Spread.Sheets.Range(0,0,10,3)]);
rule.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.twoScaleRule);
rule.minType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
rule.minValue(10);
rule.minColor("Yellow");
rule.maxType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
rule.maxValue(100);
rule.maxColor("Blue");
activeSheet.conditionalFormats.addRule(rule);
activeSheet.setValue(0,0, 1,3);
activeSheet.setValue(1,0, 50,3);
activeSheet.setValue(2,0, 100,3);

Parameters

Name Type Description
value? string The maximum color scale.

Returns

any

If no value is set, returns the maximum color scale; otherwise, returns the scale rule.


maxType

maxType(value?): any

Gets or sets the maximum scale type.

example

var scale = new GC.Spread.Sheets.ConditionalFormatting.ScaleRule();
scale.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.threeScaleRule);
scale.midColor("red");
scale.midType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.midValue(50);
scale.maxColor("blue");
scale.maxType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.maxValue(100);
scale.minColor("yellow");
scale.minType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.minValue(10);
scale.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 3)]);
activeSheet.conditionalFormats.addRule(scale);
activeSheet.setValue(0,0, 1,3);
activeSheet.setValue(1,0, 50,3);
activeSheet.setValue(2,0, 100,3);

Parameters

Name Type Description
value? ScaleValueType The maximum scale type.

Returns

any

If no value is set, returns the maximum scale type; otherwise, returns the scale rule.


maxValue

maxValue(value?): any

Gets or sets the maximum scale value.

example

var scale = new GC.Spread.Sheets.ConditionalFormatting.ScaleRule();
scale.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.twoScaleRule);
scale.maxColor("blue");
scale.maxType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.maxValue(100);
scale.minColor("yellow");
scale.minType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.minValue(10);
scale.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 3)]);
activeSheet.conditionalFormats.addRule(scale);
activeSheet.setValue(0,0, 1,3);
activeSheet.setValue(1,0, 50,3);
activeSheet.setValue(2,0, 100,3);
alert("Color: " + scale.maxColor() + " Type: " + scale.maxType() + " Value: " + scale.maxValue());

Parameters

Name Type Description
value? number The maximum scale value.

Returns

any

If no value is set, returns the maximum scale value; otherwise, returns the scale rule.


midColor

midColor(value?): any

Gets or sets the midpoint scale color.

example

var scale = new GC.Spread.Sheets.ConditionalFormatting.ScaleRule();
scale.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.threeScaleRule);
scale.midColor("red");
scale.midType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.midValue(50);
scale.maxColor("blue");
scale.maxType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.maxValue(100);
scale.minColor("yellow");
scale.minType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.minValue(10);
scale.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 3)]);
activeSheet.conditionalFormats.addRule(scale);
activeSheet.setValue(0,0, 1,3);
activeSheet.setValue(1,0, 50,3);
activeSheet.setValue(2,0, 100,3);

Parameters

Name Type Description
value? string The midpoint scale color.

Returns

any

If no value is set, returns the midpoint scale color; otherwise, returns the scale rule.


midType

midType(value?): any

Gets or sets the midpoint scale type.

example

var scale = new GC.Spread.Sheets.ConditionalFormatting.ScaleRule();
scale.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.threeScaleRule);
scale.midColor("red");
scale.midType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.midValue(50);
scale.maxColor("blue");
scale.maxType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.maxValue(100);
scale.minColor("yellow");
scale.minType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.minValue(10);
scale.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 3)]);
activeSheet.conditionalFormats.addRule(scale);
activeSheet.setValue(0,0, 1,3);
activeSheet.setValue(1,0, 50,3);
activeSheet.setValue(2,0, 100,3);

Parameters

Name Type Description
value? ScaleValueType The midpoint scale type.

Returns

any

If no value is set, returns the midpoint scale type; otherwise, returns the scale rule.


midValue

midValue(value?): any

Gets or sets the midpoint scale value.

example

var scale = new GC.Spread.Sheets.ConditionalFormatting.ScaleRule();
scale.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.threeScaleRule);
scale.midColor("red");
scale.midType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.midValue(50);
scale.maxColor("blue");
scale.maxType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.maxValue(100);
scale.minColor("yellow");
scale.minType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
scale.minValue(10);
scale.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 3)]);
activeSheet.conditionalFormats.addRule(scale);
activeSheet.setValue(0,0, 1,3);
activeSheet.setValue(1,0, 50,3);
activeSheet.setValue(2,0, 100,3);

Parameters

Name Type Description
value? number The midpoint scale value.

Returns

any

If no value is set, returns the midpoint scale value; otherwise, returns the scale rule.


minColor

minColor(value?): any

Gets or sets the minimum scale color.

example

var rule = new GC.Spread.Sheets.ConditionalFormatting.ScaleRule();
rule.ranges([new GC.Spread.Sheets.Range(0,0,10,3)]);
rule.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.twoScaleRule);
rule.minType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
rule.minValue(10);
rule.minColor("Yellow");
rule.maxType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
rule.maxValue(100);
rule.maxColor("Blue");
activeSheet.conditionalFormats.addRule(rule);
activeSheet.setValue(0,0, 1,3);
activeSheet.setValue(1,0, 50,3);
activeSheet.setValue(2,0, 100,3);

Parameters

Name Type Description
value? string The minimum scale color.

Returns

any

If no value is set, returns the minimum scale color; otherwise, returns the scale rule.


minType

minType(value?): any

Gets or sets the type of minimum scale.

example

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 dataBarRule = new GC.Spread.Sheets.ConditionalFormatting.DataBarRule();
dataBarRule.ranges([new GC.Spread.Sheets.Range(0,0,4,1)]);
dataBarRule.minType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
dataBarRule.minValue(-1);
dataBarRule.maxType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
dataBarRule.maxValue(40);
dataBarRule.color("green");
dataBarRule.showBorder(true);
dataBarRule.borderColor("orange");
dataBarRule.dataBarDirection(GC.Spread.Sheets.ConditionalFormatting.BarDirection.leftToRight);
dataBarRule.negativeFillColor("yellow");
dataBarRule.useNegativeFillColor(true);
dataBarRule.negativeBorderColor("red");
dataBarRule.useNegativeBorderColor(true);
dataBarRule.axisPosition(GC.Spread.Sheets.ConditionalFormatting.DataBarAxisPosition.automatic);
dataBarRule.axisColor("blue");
dataBarRule.showBarOnly(false);
activeSheet.conditionalFormats.addRule(dataBarRule);

Parameters

Name Type Description
value? ScaleValueType The type of minimum scale.

Returns

any

If no value is set, returns the type of minimum scale; otherwise, returns the scale rule.


minValue

minValue(value?): any

Gets or sets the minimum scale value.

example

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 dataBarRule = new GC.Spread.Sheets.ConditionalFormatting.DataBarRule();
dataBarRule.ranges([new GC.Spread.Sheets.Range(0,0,4,1)]);
dataBarRule.minType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
dataBarRule.minValue(-1);
dataBarRule.maxType(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.number);
dataBarRule.maxValue(40);
dataBarRule.color("green");
dataBarRule.showBorder(true);
dataBarRule.borderColor("orange");
dataBarRule.dataBarDirection(GC.Spread.Sheets.ConditionalFormatting.BarDirection.leftToRight);
dataBarRule.negativeFillColor("yellow");
dataBarRule.useNegativeFillColor(true);
dataBarRule.negativeBorderColor("red");
dataBarRule.useNegativeBorderColor(true);
dataBarRule.axisPosition(GC.Spread.Sheets.ConditionalFormatting.DataBarAxisPosition.automatic);
dataBarRule.axisColor("blue");
dataBarRule.showBarOnly(false);
activeSheet.conditionalFormats.addRule(dataBarRule);

Parameters

Name Type Description
value? number The minimum scale value.

Returns

any

If no value is set, returns the minimum scale value; otherwise, returns the scale rule.


priority

priority(value?): any

Gets or sets the priority of the rule.

Parameters

Name Type Description
value? number The priority of the rule.

Returns

any

If no value is set, returns the priority of the rule; otherwise, returns the condition rule.

Inherited from

ConditionRuleBase.priority


ranges

ranges(value?): any

Gets or sets the condition rule ranges.

example

var style = new GC.Spread.Sheets.Style();
style.backColor = "green";
var ranges = [new GC.Spread.Sheets.Range(0, 0, 10, 1)];
activeSheet.conditionalFormats.addUniqueRule(style, ranges);
activeSheet.setValue(0, 0, 50);
activeSheet.setValue(1, 0, 50);
activeSheet.setValue(2, 0, 11);
activeSheet.setValue(3, 0, 5);

Parameters

Name Type Description
value? Range[] The condition rule ranges.

Returns

any

If no value is set, returns the condition rule ranges; otherwise, returns the condition rule.

Inherited from

ConditionRuleBase.ranges


reset

reset(): void

Resets the rule.

Returns

void

Inherited from

ConditionRuleBase.reset


ruleType

ruleType(value?): any

Gets or sets the condition rule type.

example

//This example uses the ruleType method.
activeSheet.setArray(0,0,[1,2,3,4,5,6,7,8,9,10]);
var style = new GC.Spread.Sheets.Style();
style.backColor = "red";
style.foreColor = "black";
var cell = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule();
cell.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.cellValueRule);
cell.operator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.greaterThan);
cell.value1(5);
cell.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 1)]);
cell.style(style);
activeSheet.conditionalFormats.addRule(cell);
var style1 = new GC.Spread.Sheets.Style();
style1.foreColor = "red";
var top = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule();
top.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.top10Rule);
top.type(GC.Spread.Sheets.ConditionalFormatting.Top10ConditionType.top);
top.rank(3);
top.style(style1);
top.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 1)]);
top.stopIfTrue(true);
activeSheet.conditionalFormats.addRule(top);

Parameters

Name Type Description
value? RuleType The condition rule type.

Returns

any

If no value is set, returns the condition rule type; otherwise, returns the condition rule.

Inherited from

ConditionRuleBase.ruleType


stopIfTrue

stopIfTrue(value?): boolean

Gets whether evaluation should stop if the condition evaluates to true.

Parameters

Name Type
value? boolean

Returns

boolean

Overrides

ConditionRuleBase.stopIfTrue


style

style(value?): any

Gets or sets the style for the rule.

example

//This example applies multiple rules.
activeSheet.setArray(0,0,[1,2,3,4,5,6,7,8,9,10]);
var style = new GC.Spread.Sheets.Style();
style.backColor = "red";
style.foreColor = "black";
var cell = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule();
cell.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.cellValueRule);
cell.operator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.greaterThan);
cell.value1(5);
cell.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 1)]);
cell.style(style);
activeSheet.conditionalFormats.addRule(cell);
var style1 = new GC.Spread.Sheets.Style();
style1.foreColor = "red";
var top = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule();
top.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.top10Rule);
top.type(GC.Spread.Sheets.ConditionalFormatting.Top10ConditionType.top);
top.rank(3);
top.style(style1);
top.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 1)]);
top.stopIfTrue(true);
activeSheet.conditionalFormats.addRule(top);

Parameters

Name Type Description
value? Style The style for the rule.

Returns

any

If no value is set, returns the style for the rule; otherwise, returns the condition rule.

Inherited from

ConditionRuleBase.style