[]
        
(Showing Draft Content)

Specifying the Major and Minor Ticks in Code

There are two types of ticks on the axis: major tick has a small line and corresponding label while the minor tick has only the line across the axis.

By default, the distance between ticks is calculated automatically.

To set a specific distance, use the MajorUnit and MinorUnit properties.

Default Ticks

The following image displays the default ticks:

Custom Ticks

The following chart image uses the MajorUnit and MinorUnit properties to set the specific distance, for example:

c1Chart1.View.AxisY.MajorUnit = 5
c1Chart1.View.AxisY.MinorUnit = 1
c1Chart1.View.AxisY.MajorUnit = 5;
c1Chart1.View.AxisY.MinorUnit = 1;

Time Axis

For time axis you can specify the MajorUnit and MinorUnit as a TimeSpan value:

c1Chart1.View.AxisY.MajorUnit = TimeSpan.FromHours(12)
c1Chart1.View.AxisY.MajorUnit = TimeSpan.FromHours(12);

See Also

Grid Lines