SpreadJS 13
GC.Spread.Sheets.ConditionalFormatting Namespace / ScaleRule class / midValue Method
The midpoint scale value.
In This Topic
    midValue Method
    In This Topic
    Gets or sets the midpoint scale value.
    Syntax
    var instance = new GC.Spread.Sheets.ConditionalFormatting.ScaleRule();
    var returnValue; // Type: any
    returnValue = instance.midValue(value);
    function midValue( 
       value : number
    ) : any;

    Parameters

    value
    The midpoint scale value.

    Return Value

    If no value is set, returns the midpoint scale value; otherwise, returns the scale rule.
    Example
    The following examples use the midValue method.
    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);
    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);
    alert("Color: " + scale.midColor() + " Type: " + scale.midType() + " Value: " + scale.midValue());
    Remarks
    The default value is 50.
    See Also

    Reference

    ScaleRule class