Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Spread.Sheets supports the 支持 data bar rule规则. The data bar rule uses a bar that is displayed as the background for each cell. The length of the bar corresponds to the size of the data relative to the other data in the sheet. The longer the bar, the greater the value in the cell.
You can specify the minimum and maximum type and the value to compare in the conditional format. The minType method can be set to Number

data bar 在每一个单元格中显示了一个长条。

长条的长度与单元格中的数据有关。长条的长度越长,单元格中的值越大。

你可以设置最大值和最小值的类型和值 minType 方法可以设置为 Number, LowestValue, HighestValue, Percent, Formula, Percentile, and Automin, or Automax.和 Automin 或者 Automax。
You can use the addDataBarRule method to create a rule and add it to the collection. The BarDirection and DataBarAxisPosition types can be used to specify the data bar direction and axis position.
Using Code
This example creates a data bar rule and uses the addRule method to add the rule.

你可以使用 addDataBarRule 方法来创建一个规则并将其放到规则集合中。

BarDirection 类和 DataBarAxisPosition 类可以用来设置横条的朝向和正值的方向。
示例代码

以下例子床架你了一个 Data Bar 规则并使用了 addRule 方法添加该规则。

JavaScript

Copy Code

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="62a625e3-9455-425a-a8e0-f49f7882d8fc"><ac:plain-text-body><![CDATA[

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(GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.Number, -1, GC.Spread.Sheets.ConditionalFormatting.ScaleValueType.Number, 40, "green", [new GC.Spread.Sheets.Range(0,0,4,1)]);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);

 

]]></ac:plain-text-body></ac:structured-macro>

See Also另见
BarDirection Enumeration
DataBarRule class
DataBarAxisPosition Enumeration
ScaleValueType Enumeration