com.aspose.cells

Class DataBar

  • java.lang.Object
    • com.aspose.cells.DataBar
public class DataBar 
extends java.lang.Object

Describe the DataBar conditional formatting rule. This conditional formatting rule displays a gradated data bar in the range of cells.

Example:

//Instantiating a Workbook object
Workbook workbook = new Workbook();

Worksheet sheet = workbook.getWorksheets().get(0);

//Adds an empty conditional formatting
int index = sheet.getConditionalFormattings().add();

FormatConditionCollection fcs = sheet.getConditionalFormattings().get(index);

//Sets the conditional format range.
CellArea ca = new CellArea();

ca.StartRow = 0;

ca.EndRow = 2;

ca.StartColumn = 0;

ca.EndColumn = 0;

fcs.addArea(ca);

//Adds condition.
int idx = fcs.addCondition(FormatConditionType.DATA_BAR);

fcs.addArea(ca);

FormatCondition cond = fcs.get(idx);

//Get Databar
DataBar dataBar = cond.getDataBar();

dataBar.setColor(Color.getOrange());

//Set Databar properties
dataBar.getMinCfvo().setType(FormatConditionValueType.PERCENTILE);

dataBar.getMinCfvo().setValue(30);

dataBar.setShowValue(false);

//Put Cell Values
sheet.getCells().get("A1").putValue(10);

sheet.getCells().get("A2").putValue(120);

sheet.getCells().get("A3").putValue(260);

Property Getters/Setters Summary
com.aspose.cells.ColorgetAxisColor()
void
setAxisColor(com.aspose.cells.Colorvalue)
           Gets the color of the axis for cells with conditional formatting as data bars.
intgetAxisPosition()
void
setAxisPosition(intvalue)
           Gets or sets the position of the axis of the data bars specified by a conditional formatting rule. The value of the property is DataBarAxisPosition integer constant.
DataBarBordergetBarBorder()
Gets an object that specifies the border of a data bar.
intgetBarFillType()
void
setBarFillType(intvalue)
           Gets or sets how a data bar is filled with color. The value of the property is DataBarFillType integer constant.
com.aspose.cells.ColorgetColor()
void
setColor(com.aspose.cells.Colorvalue)
           Get or set this DataBar's Color.
intgetDirection()
void
setDirection(intvalue)
           Gets or sets the direction the databar is displayed. The value of the property is TextDirectionType integer constant.
ConditionalFormattingValuegetMaxCfvo()
Get or set this DataBar's max value object. Cannot set null or CFValueObject with type FormatConditionValueType.Min to it.
intgetMaxLength()
void
setMaxLength(intvalue)
           Represents the max length of data bar .
ConditionalFormattingValuegetMinCfvo()
Get or set this DataBar's min value object. Cannot set null or CFValueObject with type FormatConditionValueType.Max to it.
intgetMinLength()
void
setMinLength(intvalue)
           Represents the min length of data bar .
NegativeBarFormatgetNegativeBarFormat()
Gets the NegativeBarFormat object associated with a data bar conditional formatting rule.
booleangetShowValue()
void
setShowValue(booleanvalue)
           Get or set the flag indicating whether to show the values of the cells on which this data bar is applied. Default value is true.
 
Method Summary
byte[]toImage(Cell cell, ImageOrPrintOptions imgOpts)
Render data bar in cell to image byte array.
 

    • Property Getters/Setters Detail

      • getAxisColor/setAxisColor

        public com.aspose.cells.Color getAxisColor() / public void setAxisColor(com.aspose.cells.Color value)
        
        Gets the color of the axis for cells with conditional formatting as data bars.
      • getAxisPosition/setAxisPosition

        public int getAxisPosition() / public void setAxisPosition(int value)
        
        Gets or sets the position of the axis of the data bars specified by a conditional formatting rule. The value of the property is DataBarAxisPosition integer constant.
      • getBarFillType/setBarFillType

        public int getBarFillType() / public void setBarFillType(int value)
        
        Gets or sets how a data bar is filled with color. The value of the property is DataBarFillType integer constant.
      • getDirection/setDirection

        public int getDirection() / public void setDirection(int value)
        
        Gets or sets the direction the databar is displayed. The value of the property is TextDirectionType integer constant.
      • getBarBorder

        public DataBarBorder getBarBorder()
        
        Gets an object that specifies the border of a data bar.
      • getNegativeBarFormat

        public NegativeBarFormat getNegativeBarFormat()
        
        Gets the NegativeBarFormat object associated with a data bar conditional formatting rule.
      • getMinCfvo

        public ConditionalFormattingValue getMinCfvo()
        
        Get or set this DataBar's min value object. Cannot set null or CFValueObject with type FormatConditionValueType.Max to it.
      • getMaxCfvo

        public ConditionalFormattingValue getMaxCfvo()
        
        Get or set this DataBar's max value object. Cannot set null or CFValueObject with type FormatConditionValueType.Min to it.
      • getColor/setColor

        public com.aspose.cells.Color getColor() / public void setColor(com.aspose.cells.Color value)
        
        Get or set this DataBar's Color.
      • getMinLength/setMinLength

        public int getMinLength() / public void setMinLength(int value)
        
        Represents the min length of data bar .
      • getMaxLength/setMaxLength

        public int getMaxLength() / public void setMaxLength(int value)
        
        Represents the max length of data bar .
      • getShowValue/setShowValue

        public boolean getShowValue() / public void setShowValue(boolean value)
        
        Get or set the flag indicating whether to show the values of the cells on which this data bar is applied. Default value is true.

    setAxisColor

    public voidsetAxisColor(com.aspose.cells.Colorvalue)
    
    Gets the color of the axis for cells with conditional formatting as data bars.

    setAxisPosition

    public voidsetAxisPosition(intvalue)
    
    Gets or sets the position of the axis of the data bars specified by a conditional formatting rule. The value of the property is DataBarAxisPosition integer constant.

    setBarFillType

    public voidsetBarFillType(intvalue)
    
    Gets or sets how a data bar is filled with color. The value of the property is DataBarFillType integer constant.

    setDirection

    public voidsetDirection(intvalue)
    
    Gets or sets the direction the databar is displayed. The value of the property is TextDirectionType integer constant.

    setColor

    public voidsetColor(com.aspose.cells.Colorvalue)
    
    Get or set this DataBar's Color.

    setMinLength

    public voidsetMinLength(intvalue)
    
    Represents the min length of data bar .

    setMaxLength

    public voidsetMaxLength(intvalue)
    
    Represents the max length of data bar .

    setShowValue

    public voidsetShowValue(booleanvalue)
    
    Get or set the flag indicating whether to show the values of the cells on which this data bar is applied. Default value is true.
    • Method Detail

      • toImage

        public byte[] toImage(Cell cell, ImageOrPrintOptions imgOpts)
                      throws java.lang.Exception
        Render data bar in cell to image byte array.
        Parameters:
        cell - Indicate the data bar in which cell to be rendered
        imgOpts - ImageOrPrintOptions contains some property of output image
        Returns: