how to apply label rotation for Axis Labels?
Description:
Axis labels can be rotated by giving rotation angle for the label. This article describes how to apply label rotation for axis labels.
Solution:
Rotation of the axis labels are done by assigning the required value (degree) to the LabelRotationAngle property of the axis.
SfChart supports rotation in both clockwise and anti-clockwise direction. That is, both positive and negative values as follows.
Note: Here, the rotation is done with the axis label center as orgin.
The following code example assigns positive rotation angle to the axis labels.
XAML
<syncfusion:SfChart.PrimaryAxis > <syncfusion:CategoryAxis Header="Product" LabelRotationAngle="45"/> </syncfusion:SfChart.PrimaryAxis>
Output for Positive Degree:
The following screenshot describes the output for the axis labels rotated at an angle of 45o.
Figure 1: Chart with axis labels rotated with an angle of 45o.
The following code assigns negative rotation angle for the axis.
C#
this.axisChart.PrimaryAxis.LabelRotationAngle = -270;
Output for Negative Degree:
The following screenshot describes the output for the axis labels rotated at an angle of -270o.
Figure 2: Chart with axis labels rotated with an angle of -270o.