Category / Section
How to show all the axis labels?
1 min read
By default, the axis labels that are intersected with each other will be hidden. SfChart has options to make all the labels visible and position the collided labels smartly. You can either place the intersecting labels in multiple rows or rotate all the labels to fix in available position.
The following code snippet and screenshot demonstrate how to place the collided labels in multiple rows by setting the LabelsIntersectAction property to MultipleRows.
XAML:
<chart:SfChart.PrimaryAxis> <chart:CategoryAxis LabelsIntersectAction="MultipleRows" > </chart:CategoryAxis> </chart:SfChart.PrimaryAxis> …
C#:
SfChart chart = new SfChart(); CategoryAxis primaryAxis = new CategoryAxis(); chart.PrimaryAxis = primaryAxis; primaryAxis.LabelsIntersectAction = AxisLabelsIntersectAction.MultipleRows; …
Screenshot:
Alternatively, we have also an another option to rotate all the labels to avoid collision. Please refer the following code snippet and screenshot.
XAML:
<chart:SfChart.PrimaryAxis> <chart:CategoryAxis LabelRotationAngle="-45"> </chart:CategoryAxis> </chart:SfChart.PrimaryAxis> …
C#:
SfChart chart = new SfChart(); CategoryAxis primaryAxis = new CategoryAxis(); chart.PrimaryAxis = primaryAxis; primaryAxis.LabelRotationAngle=-45; …
Screenshot: