[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Drawing.IAxis.BaseUnit

BaseUnit Property

BaseUnit

Gets or sets the base unit for the specified category axis.

For a time-scale category axis, the base unit specifies whether the axis is based on days, months, or years.

Declaration
TimeUnit BaseUnit { get; set; }
Property BaseUnit As TimeUnit
Examples
worksheet.Range["A1:B4"].Value = new object[,] {
    {"Date", "Sales"},
    {new DateTime(2024, 1, 1), 12},
    {new DateTime(2024, 2, 1), 18},
    {new DateTime(2024, 3, 1), 15}
};
IChart chart = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 20, 20, 360, 220).Chart;
chart.SeriesCollection.Add(worksheet.Range["A1:B4"]);
IAxis axis = chart.Axes.Item(AxisType.Category, AxisGroup.Primary);
axis.BaseUnit = TimeUnit.Months;
TimeUnit baseUnit = axis.BaseUnit;