How to change the position of the axis in Xamarin.Forms Chart?
Essential chart for our Xamarin.Forms Chart supports positioning the chart axis on its default position or to the other side of the chart. To change the axis position, enable the OpposedPosition property of the ChartAxis. The following code example illustrates this.
XAML
<chart:SfChart> … <chart:SfChart.PrimaryAxis> <chart:CategoryAxis OpposedPosition="True"> … </chart:CategoryAxis> </chart:SfChart.PrimaryAxis> <chart:SfChart.SecondaryAxis> <chart:NumericalAxis OpposedPosition="True"> … </chart:NumericalAxis> </chart:SfChart.SecondaryAxis> … </chart:SfChart>
C#
Chart.PrimaryAxis = new CategoryAxis { //Displays the primary X Axis in opposed position. OpposedPosition = true, … }; Chart.SecondaryAxis = new NumericalAxis { //Displays the primary Y Axis in opposed position. OpposedPosition = true, … };
Output:
Figure 1: Opposite position of the chart axis.
Conclusion
I hope you enjoyed learning about how to change the position of the axis in Xamarin.Forms Chart.
You can refer to our Xamarin.Forms Chart feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!