[]
Represents a data bar conditional formatting rule.
Applying a data bar to a range helps visualize each cell value relative to the other values in the same range. Use this interface to configure the appearance and behavior of a data bar rule, such as its fill, color, axis, direction, and value display.
public interface IDataBar
Public Interface IDataBar
worksheet.Range["A1:A5"].Value = new object[,] {{1}, {2}, {3}, {4}, {5}};
IDataBar dataBar = worksheet.Range["A1:A5"].FormatConditions.AddDatabar();
dataBar.BarFillType = DataBarFillType.Solid;
dataBar.BarColor.Color = Color.Green;
dataBar.ShowValue = false;
| Name | Description |
|---|---|
| AppliesTo | Gets or sets the cell range to which this data bar conditional formatting rule is applied. Use this property to read or change the IRange associated with the current data bar rule. |
| AxisColor | Gets the color of the axis for cells with conditional formatting as data bars. Returns an IFormatColor object that you can use to read or modify the axis color of the data bar rule. |
| AxisPosition | Gets or sets the axis position of the data bars in this conditional formatting rule. The axis position controls how positive and negative data bars are separated within each cell. Use Automatic to place the axis based on the values in the range, Midpoint to keep the axis centered, or None to hide the axis. |
| BarBorder | Gets an object that specifies the border of a data bar. Use the returned IDataBarBorder object to configure the border appearance of the current data bar, such as its border type and color. |
| BarColor | Gets the color of the bars in this data bar conditional formatting rule. Returns an IFormatColor object that you can use to read or modify the fill color applied to the data bars. |
| BarFillType | Gets or sets how a data bar is filled with color. The DataBarFillType value specifies whether the data bar uses a solid fill or a gradient fill. |
| Direction | Gets or sets the display direction of the data bar. The DataBarDirection value determines whether the data bar follows the current context, is displayed from left to right, or is displayed from right to left. |
| MaxPoint | Gets the IConditionValue that specifies how the longest bar is evaluated for a data bar conditional format. Use the returned object to configure the maximum threshold for the data bar, such as a numeric limit or another supported condition value type. |
| MinPoint | Gets the IConditionValue that specifies how the shortest bar is evaluated for a data bar conditional format. Use the returned object to configure the minimum threshold for the data bar, such as a numeric limit or another supported condition value type. |
| NegativeBarFormat | Gets the negative bar format settings for this data bar conditional formatting rule. Use the returned INegativeBarFormat object to configure the fill color and border color behavior for negative values in the data bar. |
| PercentMax | Gets or sets the length of the longest data bar as a percentage of the cell width. Use this property to determine or change the maximum visual length applied to data bars in the conditional formatting rule. |
| PercentMin | Gets or sets the length of the shortest data bar as a percentage of the cell width. Use this property to determine or change the minimum visual length applied to data bars in the conditional formatting rule. |
| Priority | Gets or sets the priority value of the conditional formatting rule. The priority determines the order in which conditional formatting rules are evaluated when multiple rules exist on a worksheet. Priority values are unique within the worksheet, so changing the priority of one rule can shift the priority values of other rules. |
| ShowValue | Gets or sets whether cell values are displayed when the data bar conditional format is applied. Use this property to show or hide the original cell values together with the data bars. |
| StopIfTrue | Gets whether additional conditional formatting rules on the cell are evaluated after this data bar rule evaluates to
If this property is |
| Type | Gets the type of this conditional format. For a data bar conditional formatting rule, this property returns the corresponding FormatConditionType value, such as Databar. |
| Name | Description |
|---|---|
| Delete() | Deletes this data bar conditional formatting rule. After this method is called, the data bar is removed from the range to which it applies. |
| FromJson(string) | Loads the data bar conditional format from a JSON string. This method replaces the current data bar rule with the rule defined in the specified JSON string. The JSON content is typically generated by ToJson(). |
| SetFirstPriority() | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet. |
| SetLastPriority() | Sets the evaluation order for this data bar rule so it is evaluated after all other rules on the worksheet. Use this method to move the current data bar rule to the end of the worksheet rule priority order. |
| ToJson() | Generates a JSON string from the data bar rule. Use this method to serialize the current data bar settings so that they can be reused with FromJson(string) or stored for later use. |