Back to Devexpress

Axis.MajorTickMarks Property

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-axis-51793e16.md

latest6.4 KB
Original Source

Axis.MajorTickMarks Property

Gets or sets the position of major tick marks on the axis.

Namespace : DevExpress.Spreadsheet.Charts

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
AxisTickMarks MajorTickMarks { get; set; }
vb
Property MajorTickMarks As AxisTickMarks

Property Value

TypeDescription
AxisTickMarks

An AxisTickMarks enumeration value that specifies how major tick marks are displayed on the axis.

|

Available values:

NameDescription
Cross

Specifies that the tick marks should cross the axis.

| | Inside |

Specifies that the tick marks should be displayed inside the plot area.

| | None |

Specifies that the tick marks should not be displayed on the axis.

| | Outside |

Specifies that the tick marks should be displayed outside the plot area.

|

Remarks

Tick marks are tiny lines that are used to indicate the demarcation of the axis. Use the MajorTickMarks property to specify how major tick marks appear: whether they are displayed inside or outside the plot area, whether they cross the axis, or if they are completely hidden.

You can also use the Axis.MinorTickMarks property to add minor tick marks to the axis.

Example

The example below demonstrates how to create the clustered column chart and hide the axis major tick marks by setting the Axis.MajorTickMarks property to the AxisTickMarks.None value.

View Example

csharp
Worksheet worksheet = workbook.Worksheets["chartTask3"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet["B3:C5"]);
chart.TopLeftCell = worksheet.Cells["H2"];
chart.BottomRightCell = worksheet.Cells["N14"];

// Set the axis tick marks.
Axis axis = chart.PrimaryAxes[0];
axis.MajorTickMarks = AxisTickMarks.None;
axis = chart.PrimaryAxes[1];
axis.MajorTickMarks = AxisTickMarks.None;

// Hide the legend.
chart.Legend.Visible = false;
vb
Dim worksheet As Worksheet = workbook.Worksheets("chartTask3")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet("B3:C5"))
chart.TopLeftCell = worksheet.Cells("H2")
chart.BottomRightCell = worksheet.Cells("N14")

' Set the axis tick marks.
Dim axis As Axis = chart.PrimaryAxes(0)
axis.MajorTickMarks = AxisTickMarks.None
axis = chart.PrimaryAxes(1)
axis.MajorTickMarks = AxisTickMarks.None

' Hide the legend.
chart.Legend.Visible = False

The following code snippets (auto-collected from DevExpress Examples) contain references to the MajorTickMarks 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.

wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/CodeExamples/StyleActions.cs#L68

csharp
axis.Outline.SetNoFill();
axis.MajorTickMarks = AxisTickMarks.None;

winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/CodeExamples/StyleActions.cs#L87

csharp
axis.Outline.SetNoFill();
axis.MajorTickMarks = AxisTickMarks.None;

spreadsheet-document-api-chart-examples/CS/SpreadsheetDocServerChartAPISamples/CodeExamples/StyleActions.cs#L93

csharp
axis.Outline.SetNoFill();
axis.MajorTickMarks = AxisTickMarks.None;

wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeExamples/StyleActions.vb#L72

vb
axis.Outline.SetNoFill()
axis.MajorTickMarks = AxisTickMarks.None

winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/CodeExamples/StyleActions.vb#L71

vb
axis.Outline.SetNoFill()
axis.MajorTickMarks = AxisTickMarks.None

spreadsheet-document-api-chart-examples/VB/SpreadsheetDocServerChartAPISamples/CodeExamples/StyleActions.vb#L93

vb
axis.Outline.SetNoFill()
axis.MajorTickMarks = AxisTickMarks.None

See Also

MinorTickMarks

Axis Interface

Axis Members

DevExpress.Spreadsheet.Charts Namespace