[]
        
(Showing Draft Content)

INegativeBarFormat

Interface INegativeBarFormat


public interface INegativeBarFormat
Represents the color settings of the data bars for negative values that are defined by a data bar conditional formating rule.

Use this interface to configure how negative values are displayed in a data bar rule, including whether their fill and border use dedicated colors or the same colors as positive data bars.


 worksheet.getRange("A1:A4").setValue(new Object[][] {{-10}, {-5}, {0}, {20}});
 IDataBar dataBar = worksheet.getRange("A1:A4").getFormatConditions().addDatabar();
 INegativeBarFormat negativeBarFormat = dataBar.getNegativeBarFormat();
 negativeBarFormat.setColorType(DataBarNegativeColorType.Color);
 negativeBarFormat.setBorderColorType(DataBarNegativeColorType.SameAsPositive);
 
  • Method Details

    • getBorderColor

      IFormatColor getBorderColor()
      Gets a FormatColor object that you can use to specify the border color for negative data bars.

      Use the returned IFormatColor object to customize the dedicated border color when setBorderColorType(DataBarNegativeColorType) is set to DataBarNegativeColorType.Color.

      
       worksheet.getRange("A1:A4").setValue(new Object[][] {{-10}, {-5}, {0}, {20}});
       IDataBar dataBar = worksheet.getRange("A1:A4").getFormatConditions().addDatabar();
       INegativeBarFormat negativeBarFormat = dataBar.getNegativeBarFormat();
       negativeBarFormat.setBorderColorType(DataBarNegativeColorType.Color);
       IFormatColor borderColor = negativeBarFormat.getBorderColor();
       borderColor.setColor(Color.GetRed());
       
      Returns:
      The IFormatColor object that specifies the border color for negative data bars.
    • getBorderColorType

      DataBarNegativeColorType getBorderColorType()
      Gets whether to use the same border color as positive data bars.

      Returns a DataBarNegativeColorType value that indicates whether negative data bars use the same border color as positive data bars or use the color specified by getBorderColor().

      
       worksheet.getRange("A1:A4").setValue(new Object[][] {{-10}, {-5}, {0}, {20}});
       IDataBar dataBar = worksheet.getRange("A1:A4").getFormatConditions().addDatabar();
       dataBar.getNegativeBarFormat().setBorderColorType(DataBarNegativeColorType.SameAsPositive);
       DataBarNegativeColorType borderColorType = dataBar.getNegativeBarFormat().getBorderColorType();
       
      Returns:
      A DataBarNegativeColorType value that specifies how the border color of negative data bars is determined.
    • setBorderColorType

      void setBorderColorType(DataBarNegativeColorType value)
      Sets whether to use the same border color as positive data bars.

      Use DataBarNegativeColorType.SameAsPositive to make negative data bars use the positive bar border color, or DataBarNegativeColorType.Color to use a dedicated border color for negative data bars.

      
       worksheet.getRange("A1:A4").setValue(new Object[][] {{-10}, {-5}, {0}, {20}});
       IDataBar dataBar = worksheet.getRange("A1:A4").getFormatConditions().addDatabar();
       INegativeBarFormat negativeBarFormat = dataBar.getNegativeBarFormat();
       negativeBarFormat.setBorderColorType(DataBarNegativeColorType.Color);
       
      Parameters:
      value - The negative data bar border color behavior.
    • getColor

      IFormatColor getColor()
      Gets a FormatColor object that you can use to specify the fill color for negative data bars.

      Use the returned IFormatColor object to customize the dedicated fill color when setColorType(DataBarNegativeColorType) is set to DataBarNegativeColorType.Color.

      
       worksheet.getRange("A1:A4").setValue(new Object[][] {{-10}, {-5}, {0}, {20}});
       IDataBar dataBar = worksheet.getRange("A1:A4").getFormatConditions().addDatabar();
       INegativeBarFormat negativeBarFormat = dataBar.getNegativeBarFormat();
       negativeBarFormat.setColorType(DataBarNegativeColorType.Color);
       IFormatColor color = negativeBarFormat.getColor();
       color.setColor(Color.GetRed());
       
      Returns:
      The IFormatColor object that specifies the fill color for negative data bars.
    • getColorType

      DataBarNegativeColorType getColorType()
      Gets whether to use the same fill color as positive data bars.

      Returns a DataBarNegativeColorType value that indicates whether negative data bars use their own fill color or reuse the positive data bar fill color.

      
       worksheet.getRange("A1:A4").setValue(new Object[][] {{-10}, {-5}, {0}, {20}});
       IDataBar dataBar = worksheet.getRange("A1:A4").getFormatConditions().addDatabar();
       dataBar.getNegativeBarFormat().setColorType(DataBarNegativeColorType.SameAsPositive);
       DataBarNegativeColorType colorType = dataBar.getNegativeBarFormat().getColorType();
       
      Returns:
      A DataBarNegativeColorType value that specifies whether negative data bars use the same fill color as positive data bars.
    • setColorType

      void setColorType(DataBarNegativeColorType value)
      Sets whether to use the same fill color as positive data bars.

      Use DataBarNegativeColorType.SameAsPositive to make negative data bars use the positive data bar fill color, or DataBarNegativeColorType.Color to use the dedicated negative bar fill color.

      
       worksheet.getRange("A1:A4").setValue(new Object[][] {{-10}, {-5}, {0}, {20}});
       IDataBar dataBar = worksheet.getRange("A1:A4").getFormatConditions().addDatabar();
       INegativeBarFormat negativeBarFormat = dataBar.getNegativeBarFormat();
       negativeBarFormat.setColorType(DataBarNegativeColorType.SameAsPositive);
       
      Parameters:
      value - The negative data bar fill color mode. Must not be null.