Syncfusion.XlsIO Namespace > IDataBar Interface : DataBarAxisPosition Property

DataBarAxisPosition Property

Gets or sets the axis position for the data bar.
Property DataBarAxisPosition As DataBarAxisPosition
Dim instance As IDataBar
Dim value As DataBarAxisPosition
instance.DataBarAxisPosition = value
value = instance.DataBarAxisPosition
DataBarAxisPosition DataBarAxisPosition {get; set;}
The position of the DataBar Axis is based on the values present in the cells, It's DataBarAxisPosition.automatic by default. If the cells contain positve and negative values then the Axis position will be cell's middle position. If the cells contain either positive or negative values then the DataBar's axis will be based on the values. Though we have only positive elements loaded, Here we set DataBar axis to DataBarAxisPosition.middle.
using Syncfusion.XlsIO;
class Example
    static void Main()
        using (ExcelEngine excelEngine = new ExcelEngine())
            //Create a worksheet.        
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;            
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
            //Load data to Apply Conditional Formatting.
            worksheet["A1"].Text = "DataBar";
            worksheet["A2"].Number = 10;
            worksheet["A3"].Number = 20;
            worksheet["A4"].Number = 30;
            worksheet["A5"].Number = 40;
            worksheet["A6"].Number = 50;
            worksheet["A7"].Number = 60;
            worksheet["A8"].Number = 70;
            worksheet["A9"].Number = 80;
            worksheet["A10"].Number = 90;
            worksheet["A11"].Number = 100;
            //Create instance of IConditonalFormat and IConditionalFormats.
            IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
            IConditionalFormat format = formats.AddCondition();
            //Set FormatType as DataBar.
            format.FormatType = ExcelCFType.DataBar;
            IDataBar dataBar = format.DataBar;
            //Set Bar Axis Position.
            dataBar.DataBarAxisPosition = DataBarAxisPosition.middle;
            //Save and Dispose.

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also