We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfChart Y-Axis control alignment

Thread ID:





142825 Feb 21,2019 05:43 AM UTC Feb 22,2019 11:17 AM UTC Xamarin.Forms 3
Tags: SfChart
Mikolaj Kieres
Asked On February 21, 2019 05:43 AM UTC


I would like to ask how could I align some content with the y-axis of the chart? What I'm trying to achieve is (poorly) represented on the below screenshot.

Thanks in advance for any suggestions


Bharathiraja K [Syncfusion]
Replied On February 21, 2019 06:44 AM UTC

Hi Mikolaj 
Greetings from Syncfusion. You can add the content to Y-Axis using our annotation support. Please find the below help document link for more details. 
To customize the Axis, please refer the below help document link. 
Please go through our help document guidelines and let us know if you need further assistance on this. 

Replied On February 21, 2019 10:45 AM UTC

Hi Bharathiraja,

Thanks for your quick response. 

Unfortunately your suggestion is not going to work in this case, as there's much more than a label that needs to be under the chart and needs to be left aligned with the y-axis of the chart. I showed a label just as an example. Also, the content that needs to be aligned is not a part of the chart (it's placed under the chart).

My thinking was that I just need to get the x position of the y-axis on the screen, which would allow me to set margin on the content that needs to be aligned with it. Hopefully that clears things a bit and you could suggest some other approach?


Bharathiraja K [Syncfusion]
Replied On February 22, 2019 11:17 AM UTC

We have analyzed your query and we can achieve your requirement using the chart Annotation and by setting the CoordinateUnit value as Pixels.  
Code Snippet [XAML]: 
                    <chart:TextAnnotation x:Name="textAnnotation" Text="Some Label"       
                      HorizontalTextAlignment="End" VerticalTextAlignment="Center">                                                                                      
Code Snippet [C#]: 
private void SecondaryAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
            textAnnotation.Y1 = chart1.ValueToPoint(secondaryAxis,   
                                              (double)e.ActualMinimum)+ 80; 
private void PrimaryAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
            textAnnotation.X1 = chart1.ValueToPoint(primaryAxis,   
We have prepared a sample for your requirement and you can download the sample from the below link. 
Please refer the below UG link for more details about positioning annotation based on CoordinateUnit as pixels:  
Label extent: 
Query: I just need to get the x position of the y-axis on the screen, which would allow me to set margin on the content that needs to be aligned with it? 
We can able to get the screen position value using the ValueToPoint(ChartAxis axis, double value) method of the chart which converts data point value to screen point. 
Transform axis value to pixel value and vice-versa: 
Please let us know if you need any further assistance. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon