ChartDirector 6.0 (Ruby Edition)

Axis.setLabelAlignment


Usage

setLabelAlignment(alignment [, minLabelSpace ])

Description

Sets the alignment of the axis labels relative to their associated ticks.

By default, axis labels on a horizontal axis will be horizontally center aligned to their associated ticks. If alignment is set to 1, the labels will move to the positive axis direction, which is the right side if the axis is not reversed (see Axis.setReverse), so that they are left aligned with the ticks, that is, the left side of the labels will be at the tick position. Similarly, if alignment is set to -1, the labels will move to the left so that they are right aligned with the ticks. Setting alignment to a larger positive and negative number will also move the labels to left or right aligned with the ticks, but with an extra margin equal to the absolute value of alignment minus 1.

The same behaviour applies to a vertical axis except that vertical alignment will be used instead of horizontal alignment.

When the labels are moved, labels near the edge of the plot area can partly or completely move outside the plot area border. The minLabelSpace argument specifies in pixels the minimum space that must be available at the plot area border in order to display the label. The default value is 3, which means the label will be displayed even if there are only 3 pixels left. In other words, unless the label moves completely or almost completely outside the plot area border, it will still be displayed.

Arguments

ArgumentDefaultDescription
alignment(Mandatory)The alignment of the label relative to the associated tick.
minLabelSpace3The minimum space in pixels that must be available at the plot area border in order to display the label

Return Value

None