Skip to main content

Axis.MajorUnit Property

Gets or sets the distance between the major tick marks and major gridlines on the chart.

Namespace: DevExpress.Spreadsheet.Charts

Assembly: DevExpress.Spreadsheet.v24.1.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

double MajorUnit { get; set; }

Property Value

Type Description
Double

A Double value that specifies the major unit for the value or date axis.

Remarks

The MajorUnit property determines how many intervals the value or date axis is divided into. To automatically evaluate the major unit value, utilize the Axis.SetAutoMajorUnit method.

Use the Axis.BaseTimeUnit property to specify the base time unit for the date axis. The base unit indicates how to plot data along the axis (in days, months, or years). You can also set the time unit for major and minor tick marks on the date axis by utilizing the Axis.MajorTimeUnit and Axis.MinorTimeUnit properties, respectively.

Example

The example below demonstrates how to create the 100% Stacked Bar chart and specify the interval of major tick marks and major gridlines for the value axis by using the Axis.MajorUnit property.

View Example

Worksheet worksheet = workbook.Worksheets["chartTask2"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.BarFullStacked);
chart.TopLeftCell = worksheet.Cells["E3"];
chart.BottomRightCell = worksheet.Cells["K14"];
// Select chart data.
chart.SelectData(worksheet["B4:C8"], ChartDataDirection.Row);

// Set the major unit of the value axis.
chart.PrimaryAxes[1].MajorUnit = 0.2;

// Hide the legend.
chart.Legend.Visible = false;

The following code snippets (auto-collected from DevExpress Examples) contain references to the MajorUnit property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also