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

Number abbreviations on axis

Thread ID:





145277 Jun 14,2019 08:47 PM UTC Jun 18,2019 05:33 AM UTC Xamarin.Forms 3
Tags: SfChart
Peter Yates
Asked On June 14, 2019 08:47 PM UTC

Is there any way to abbreviate numbers on an axis label? For example turn $1,000,000 into $1m and turn $1,000 into $1k. In addition I need it to work dynamically so the abbreviation changes on demand as the user shows and hides data series in a chart and the range on the axis changes accordingly.

Not a huge deal, just trying to save some screen space on the y axis labels on smaller screens when the numbers get really big.


Bharathiraja K [Syncfusion]
Replied On June 17, 2019 09:12 AM UTC

Hi Peter,  
Greetings from Syncfusion. You can abbreviate the axis label, by modifying the label content in LabelCreated event of NumericalAxis class. This event will be triggered for every label created and passes the values using the event arguments such as Position, LabelContent and LabelStyle. We can provide customization to the individual labels by using these arguments. 
  <chart:NumericalAxis Minimum="1000" Maximum="1000000"   LabelCreated="NumericalAxis_LabelCreated"> 
private void NumericalAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e) 
            var position = e.Position; 
            var label = position.ToString("#,#", CultureInfo.InvariantCulture); 
            if (position >= 1000 && position < 1000000) 
                label = position.ToString("#,##0,K", CultureInfo.InvariantCulture); 
            else if (position >= 1000000 && position < 1000000000) 
                label = position.ToString("#,##0,,M", CultureInfo.InvariantCulture); 
            else if (position >= 1000000000) 
                label = position.ToString("#,##0,,,B", CultureInfo.InvariantCulture); 
            e.LabelContent = label; 
We have prepared the sample based on your requirement and it can be downloaded from the below link. 

Peter Yates
Replied On June 17, 2019 09:01 PM UTC

Thanks for the quick response. That works great.

Bharathiraja K [Syncfusion]
Replied On June 18, 2019 05:33 AM UTC

Hi Peter, 
Thanks for your update.  


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