Tick Marks

TickMarks are small vertical and horizontal measurement lines intersecting the x-axis (XAxis) and y-axis (YAxis) respectively. Add tick marks independently or in conjunction with grid lines. If a Chart instance's AutoLayout property is set True, the chart displays tick marks automatically (True is the default value). There are two types of tick marks, XAxisTickMarks and YAxisTickMarks.

When working with tick marks and/or grid lines, be sure to review the results and modify each to produce the desired results. Tick marks and grid lines work together when formatting a graph's visual display.

TickMarks

The TickMarks class is parent to the XAxisTickMarks class and YAxisTickMarks class. Most of the properties used for formatting these two child classes are inherited from the TickMarks parent class.

Properties

Property Description
Color Gets or sets the Color object to use for the color of the TickMarks.
Interval Gets or sets the interval of the TickMarks.
Length Gets or sets the length of the TickMarks.
LineStyle Gets or sets LineStyle enumeration that specifies the LineStyle of the TickMarks.
Visible Gets or sets the visible status of the TickMarks. By default it is True.
Width Gets or sets the width of the TickMarks.

XAxisTickMarks

A chart's x-axis uses XAxisTickMarks. Tick marks can be major tick marks or minor tick marks. MajorTickMarks (a property of XAxis) are drawn that correspond to each MajorGridLines and MinorTickMarks are drawn for each MinorGridLines on the XAxis.

It is not required that a chart display both tick marks and grid lines. But, by default XAxisTickMarks are displayed on a chart.

An XAxisTickMarks position is determined by the XAxisTickMarkPosition enumeration. Values are Above, Across, Automatic, and Below (Below is the default). An XAxisTickMarks instance's length and width are also configurable. The default length of major tick marks is four and for minor tick marks is 2. By default the interval between MajorTickMarks is the interval for the XAxis and the interval for MinorTickMarks is half the interval of the XAxis. These intervals correspond to the grid line intervals if setting grid lines for a chart.

Properties

The majority of XAxisTickMarks properties are inherited from the TickMarks class.

Property Description
Position Gets or sets the XAxisTickMarksPosition enumeration that specifies the position of the XAxisTickMarks.

Example

The following code shows how to Add XAxisTickMarks to an XAxis.

Chart chart = new Chart(0, 0, 300, 200);
PlotArea plotArea = chart.PrimaryPlotArea;  
plotArea.XAxes.DefaultNumericXAxis.MajorTickMarks = new XAxisTickMarks();
plotArea.XAxes.DefaultNumericXAxis.MinorTickMarks = new XAxisTickMarks();         
Dim MyChart As Chart = New Chart(0, 0, 300, 200)
Dim MyPlotArea = MyChart.PrimaryPlotArea
MyPlotArea.XAxes.DefaultNumericXAxis.MajorTickMarks = New XAxisTickMarks()
MyPlotArea.XAxes.DefaultNumericXAxis.MajorTickMarks = New XAxisTickMarks()  

Refer to the XAxisTickMarks API documentation for a complete example.

YAxisTickMarks

The YAxis of a chart uses YAxisTickMarks. As with the XAxisTickMarks, tick marks can be major tick marks or minor tick marks. MajorTickMarks (a property of YAxis) are drawn that correspond to each MajorGridLines and MinorTickMarks are drawn for each MinorGridLines on the YAxis.

It is not required that a chart display both tick marks and grid lines. But, by default YAxisTickMarks are displayed on a chart. But, YAxisTickMarks are displayed by default.

The YAxisTickMarkPosition enumeration determines the positioning of the YAxisTickMarks. The values are Across, Automatic, Left, and Right (the default is left). The default length of a tick mark is four and width is two. By default the interval between MajorTickMarks is the interval for the YAxis and the interval for MinorTickMarks is half the interval of the YAxis.

Properties

The majority of the YXaxisTickMarks class inherits its properties from the TickMarks class.

Property Description
Position Gets or sets the YAxisTickMarksPosition enumeration that specifies the position of the YaxisTickMarks.

Example

The following code shows how to add YAxisTickMarks to the YAxis.

Chart chart = new Chart(0, 0, 300, 200);
PlotArea plotArea = chart.PrimaryPlotArea;
plotArea.YAxes.DefaultNumericYAxis.MajorTickMarks = new YAxisTickMarks();
plotArea.YAxes.DefaultNumericYAxis.MinorTickMarks = new YAxisTickMarks();        
Dim MyChart As Chart = New Chart(0, 0, 300, 200)
Dim MyPlotArea = MyChart.PrimaryPlotArea
MyPlotArea.YAxes.DefaultNumericYAxis.MajorTickMarks = New YAxisTickMarks()
MyPlotArea.YAxes.DefaultNumericYAxis.MajorTickMarks = New YAxisTickMarks()

Refer to the YAxisTickMarks API documentation for a complete example.

In this topic