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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Axis title position

Thread ID:

Created:

Updated:

Platform:

Replies:

145209 Jun 12,2019 01:18 PM UTC Jun 13,2019 11:12 AM UTC Xamarin.Forms 1
loading
Tags: SfChart
Pablo
Asked On June 12, 2019 01:18 PM UTC

Hello, is it possible to change the axis title position? I didn't find anything related in the documentation.
Something like this:


Thanks in advance

Bharathiraja K [Syncfusion]
Replied On June 13, 2019 11:12 AM UTC

Hi Pablo, 
 
Greetings. Currently we don’t have support to customize the axis title position. Instead of axis title, we can achieve your requirement by using axis label created event to add the text like the given image. 
 
[XAML] 
<chart:NumericalAxis x:Name="XAxis" LabelCreated="LabelCreated" EdgeLabelsVisibilityMode="AlwaysVisible" EdgeLabelsDrawingMode="Fit" Minimum="0" Maximum="24" Interval="3" ShowMajorGridLines="False" ShowMinorGridLines="False"> 
. . .                     
</chart:NumericalAxis> 
 
[C#] Changing the final label content  
private void LabelCreated(object sender, ChartAxisLabelEventArgs e) 
        { 
            var axis = sender as NumericalAxis; 
            if(axis == chart.SecondaryAxis && e.Position == axis.Maximum) 
            { 
                e.LabelContent = "KWh";  
                e.LabelStyle = new ChartAxisLabelStyle() { FontAttributes = FontAttributes.Bold }; 
            } 
            else if(axis == chart.PrimaryAxis && e.Position == axis.Maximum) 
            { 
                e.LabelContent += "h"; 
                e.LabelStyle = new ChartAxisLabelStyle() { FontAttributes = FontAttributes.Bold }; 
            } 
        } 
 
To know more about Label created event please refer the below link. 
 
We have prepared the sample that can be downloaded from below link. 
 
 
 
Regards, 
Bharathi. 


CONFIRMATION

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