Articles in this section
Category / Section

How to change the position of the axis?

1 min read

Essential chart for Xamarin.Forms 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:

Chart X Axis and Y Axis placed in opposed position in Xamarin.Forms

Figure 1: Opposite position of the chart axis.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied