aspose.cells

Class DataBar

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
var workbook = new aspose.cells.Workbook();
var sheet = workbook.getWorksheets().get(0);

//Adds an empty conditional formatting
var index = sheet.getConditionalFormattings().add();
var fcs = sheet.getConditionalFormattings().get(index);

//Sets the conditional format range.
var ca = new aspose.cells.CellArea();
ca.StartRow = 0;
ca.EndRow = 2;
ca.StartColumn = 0;
ca.EndColumn = 0;
fcs.addArea(ca);

//Adds condition.
var idx = fcs.addCondition(aspose.cells.FormatConditionType.DATA_BAR);
fcs.addArea(ca);
var cond = fcs.get(idx);

//Get Databar
var dataBar = cond.getDataBar();
dataBar.setColor(aspose.cells.Color.getOrange());

//Set Databar properties
dataBar.getMinCfvo().setType(aspose.cells.FormatConditionValueType.PERCENTILE);
dataBar.getMinCfvo().setValue(30);
dataBar.setShowValue(false);

//Put Cell Values
var cell1 = sheet.getCells().get("A1");
cell1.putValue(10);
var cell2 = sheet.getCells().get("A2");
cell2.putValue(120);
var cell3 = sheet.getCells().get("A3");
cell3.putValue(260);

//Saving the Excel file
workbook.save("Book1.xlsx");

Property Getters/Setters Summary
functiongetAxisColor()
function
           Gets the color of the axis for cells with conditional formatting as data bars.
functiongetAxisPosition()
function
           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.
functiongetBarBorder()
Gets an object that specifies the border of a data bar.
functiongetBarFillType()
function
           Gets or sets how a data bar is filled with color. The value of the property is DataBarFillType integer constant.
functiongetColor()
function
setColor(value)
           Get or set this DataBar's Color.
functiongetDirection()
function
           Gets or sets the direction the databar is displayed. The value of the property is TextDirectionType integer constant.
functiongetMaxCfvo()
Get or set this DataBar's max value object. Cannot set null or CFValueObject with type FormatConditionValueType.Min to it.
functiongetMaxLength()
function
           Represents the max length of data bar .
functiongetMinCfvo()
Get or set this DataBar's min value object. Cannot set null or CFValueObject with type FormatConditionValueType.Max to it.
functiongetMinLength()
function
           Represents the min length of data bar .
functiongetNegativeBarFormat()
Gets the NegativeBarFormat object associated with a data bar conditional formatting rule.
functiongetShowValue()
function
           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
functiontoImage(cell, imgOpts)
Render data bar in cell to image byte array.
 

    • Property Getters/Setters Detail

      • getAxisColor/setAxisColor : Color 

        function getAxisColor() / function setAxisColor(value)
        
        Gets the color of the axis for cells with conditional formatting as data bars.
      • getAxisPosition/setAxisPosition : Number 

        function getAxisPosition() / function setAxisPosition(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 : Number 

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

        function getDirection() / function setDirection(value)
        
        Gets or sets the direction the databar is displayed. The value of the property is TextDirectionType integer constant.
      • getBarBorder : DataBarBorder 

        function getBarBorder()
        
        Gets an object that specifies the border of a data bar.
      • getNegativeBarFormat : NegativeBarFormat 

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

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

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

        function getColor() / function setColor(value)
        
        Get or set this DataBar's Color.
      • getMinLength/setMinLength : Number 

        function getMinLength() / function setMinLength(value)
        
        Represents the min length of data bar .
      • getMaxLength/setMaxLength : Number 

        function getMaxLength() / function setMaxLength(value)
        
        Represents the max length of data bar .
      • getShowValue/setShowValue : boolean 

        function getShowValue() / function setShowValue(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.
    • Method Detail

      • toImage

        function toImage(cell, imgOpts)
        Render data bar in cell to image byte array.
        Parameters:
        cell: Cell - Indicate the data bar in which cell to be rendered
        imgOpts: ImageOrPrintOptions - ImageOrPrintOptions contains some property of output image
        Returns: