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. |