Nevron Open Vision Documentation
Ticks

Ticks are usually represented as lines and can appear on both sides of the scale ruler. In NOV scales define two types of ticks – major and minor.

In general major ticks are used to mark important values on the scale and are usually accompanied by a label that displays their value. Minor ticks on the other hand mark less significant values and are usually displayed between the major ticks. By default minor ticks are disabled. This topic will discuss the options provided for tick customization by the NStandardScale derived classes only.

Major Tick Values

Major tick values are controlled through the ENMajorTickMode property of the NStandardScale accepting values from the ENMajorTickMode enumeration. The following table shows the possible values you can set to this property:

ENMajorTickMode Description
AutoMinDistance The scale will automatically calculate the step depending on the setting of the MinTickDistance property and will not allow ticks to be closer than the specified distance. In this mode the number of scale ticks will increase as the scale is bigger on the screen or printer and decrease when the scale is smaller respectively. This is the default setting.
AutoMaxCount The scale will automatically generate steps depending on the setting of the MaxTickCount property. In this mode the number of ticks will be restricted to the maximum allowed number of ticks. The scale will automatically select a "nice" step given the range of the data. The number of ticks will be constant when the scale is resized.
CustomTicks In this mode you can explicitly specify the values which must be represented with major ticks. You add custom ticks to the scale via the CustomTicks property.
CustomStep In this mode you can explicitly specify a custom step which must be used in the major tick generation. The step is specified with the CustomStep property.
CustomSteps In this mode you can explicitly specify an array of steps that must be used for major tick generation. The steps are specified from the CustomSteps property.

The MinTickDistance and MaxTickCount properties are defined in the NStandardScale and all scales that inherit from it can access them. The following code will increase the default spacing between ticks on the screen:

C#
Copy Code

NStandardScale scale = axis.Scale as NStandardScale;

scale.MajorTickMode = ENMajorTickMode.AutoMinDistance;

scale.MinTickDistance = 50;

The rest of the major tick modes imply that you have to provide some information to the scale in terms of actual ticks or step to be used when generating the ticks. Because the step or steps can vary in type the CustomStep, CustomSteps and CustomTicks properties are defined in the scale that uses them.

The following table shows the type of values accepted by these properties, depending on the type of the scale:

Scale Accepted values
NNumericScale

CustomStep accepts positive double values.

CustomSteps accepts a dom array of positive double values.

CustomTicks accepts a dom array of arbitrary double values.

NDateTimeScale

CustomStep accepts a NDateTimeSpan value.

CustomStep accepts a dom array of NDateTimeSpan values.

CustomTicks accepts a dom array of DateTime values.

NOrdinalScale

CustomStep accepts a positive integer value.

CustomSteps accepts a dom array of positive integer values.

CustomTicks accepts a dom array of arbitrary integer values.

Tick Appearance

The NStandardScaleConfigurator has four properties of type NScaleTicks that define the appearance of the various ticks that appear on the scale. Following is a description of the meaning of each property:

InnerMajorTicks - Controls the appearance of major ticks that appear on the inner side of the scale (usually inside the plot area)

OuterMajorTicks - Controls the appearance of major ticks that appear on the outer side of the scale (usually outside the plot area)

InnerMinorTicks - Controls the appearance of minor ticks that appear on the inner side of the scale (usually inside the plot area)

OuterMinorTicks - Controls the appearance of minor ticks that appear on the outer side of the scale (usually outside the plot area)

 

Note: Major Tick appearance may be altered if the tick falls inside a scale section. Scale sections are described in the Scale Sections topic.

The following code will alter the color and length of the major outer ticks:

C#
Copy Code

scale.OuterMajorTicks.Stroke.Color = NColor.Red;

scale.OuterMajorTicks.Length = 6;

 

Minor Ticks

Minor ticks are displayed between the major ticks and by default are configured to look smaller. The minor tick values can be generated in two ways:

Automatic

Automatic minor ticks are synchronized with the major ticks and separate the range between two major ticks on equal intervals. The number of minor ticks between two major ticks is specified by the MinorTickCount property of the NStandardScale. The following code will set this property to 4 resulting in four minor ticks between each two major ticks:

C#
Copy Code

scale.MinorTickCount = 4;

Custom

Custom minor ticks can appear on any value. In order to display custom minor ticks you need to set the AutoMinorTicks property to false and manually specify the tick values. The following example shows how to achieve this:

C#
Copy Code

scale.AutoMinorTicks = false;

scale.CustomMinorTicks = new NDomArray<double>(new double[] { 15, 30, 45 } );

Send Feedback