Overview
There are a total of two rows for axis labels, and the second row of labels can only be generated using custom labels. However, the first row can be generated from the axis scale, from data points, from a combination of data point and axis scale labels, or from custom labels.
For more information on how labels are created see the topic on Labelling Methods.
Only the first label row of labels can be displayed using an offset. However, if a custom label is used for the first row of data, then the axis scale and data point labels will not be used. To offset labels in a row, use the LabelStyle.Offset property of the Axis object. If auto-fitting is enabled by setting the LabelsAutoFit to True, then the Offset property, as well as the Angle and Font.Size properties of the Axis.LabelStyle object, will be ignored.
Figure 1: Two label rows with the first row having its labels offset.
Axes Label Sizing and Positioning
Axis labels can be automatically sized either on an axis-by-axis basis, or for all axes within a chart area. If auto sizing is not preferred, you have the option to manually size and position all of the axes labels yourself. To automatically size all axes labels in a chart area, and maintain a consistent size, simply set the ChartArea.EquallySizedAxesLabels to true.
Note |
---|
Setting ChartArea.EquallySizedAxesLabels property will only effect those axes that are enabled, and have their LabelsAutoFit property set to true. |
To use automatic positioning for labels on a specific axis, set the Axis object's LabelsAutoFit property to True. It should be noted that this is the default setting for this property. The label angle, font size, and offset will be automatically adjusted to best fit the label's text, and as a result the Font.Size, FontAngle and OffsetLabels properties (of the AxisLabels.LabelStyle object) will be ignored when auto-fitting is enabled.
If you set the LabelsAutoFit property to True, then you can set the LabelsAutoFitMinFontSize, and LabelsAutoFitMaxFontSize properties to limit the range of values that will be used to calculate the font size of the labels. For example, if you set these properties to 6 and 14, respectively, the labels auto-fit algorithm will only consider font sizes in the range of 6 to 14, and using that range, will determine an optimum font size for the axis labels. If the LabelsAutoFit property is False, then the Font.Size, FontAngle, and OffsetLabels properties will be used.
By default, the first and last tick marks, and all data points will have a label generated for them. This behavior can be changed by using the ShowEndLabels, Interval, and IntervalOffset properties of the axis' LabelStyles object.