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

How to remove comma(,) in x-axis label?

Thread ID:





150126 Dec 21,2019 10:46 AM UTC Dec 24,2019 05:54 AM UTC Xamarin.Forms 3
Tags: SfChart
Asked On December 21, 2019 10:46 AM UTC

Please check the link below I have given the output image of my following code.

Expected Result :
I need time on the x-axis should be (5:00 Am 10:00 AM 11:00 Pm). when I set time in category axis after time comma will appear I don't know how to remove it.

Actual Result :


LineChart.PrimaryAxis = new CategoryAxis()
                CrossesAt = 0,
                EnableAutoIntervalOnZooming = true,
                PlotOffset = 5,
                ShowMajorGridLines = false,
                AxisLineStyle = new ChartLineStyle{ StrokeWidth = 0 },
                MajorTickStyle=new ChartAxisTickStyle { TickSize = 0 },
                LabelStyle=new ChartAxisLabelStyle { 
                    LabelFormat = "hh:mm tt",
                    FontFamily = "Avenir-Medium.ttf",
                    FontSize = 11, 
                    TextColor = Color.FromHex("#6D76AF") }

Hemalatha Marikumar [Syncfusion]
Replied On December 23, 2019 06:17 AM UTC

Hi Bharath,

Greetings from Syncfusion.
We have validated your query with provided screenshot, and we would like to let you know this is our new behavior of X- axis label rendering from Volume 3,2019 release while having the different category values on the series collection. 
Until our previous release we have shown first series category values alone in axis labels, we have implemented new feature in Volume 3 release to show all the series different category values with comma. 

For more details please refer below UG and release notes.

UG link : https://help.syncfusion.com/xamarin/sfchart/axis#indexed-category-axis 
However, you can show first series values alone in axis labels in our latest version by invoking LabelCreated event in CategoryAxis then customizing the axis label based on your requirement as per the below code snippet.  
Code Snippet [Xaml]: 
       <chart:CategoryAxis LabelCreated="CategoryAxis_LabelCreated" />  
Code Snippet [C#]:  
private void CategoryAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e)  
    e.LabelContent = e.LabelContent.Split(',')[0].Trim();  
And we have prepared a sample based on your requirement and you can download the sample from the below link.  
Please let us know if need any further assistance on this. 
Hemalatha M. 

Replied On December 23, 2019 07:07 AM UTC

Hi Hemalatha,

Thank you for your support issue is resolved. I have one more question for you. Please check the link below.

if you see in that image ending text of x-axis label is not showing full. How do fix this issue?

Hemalatha Marikumar [Syncfusion]
Replied On December 24, 2019 05:54 AM UTC

Hi Bharath,  
Thanks for the update and we are glad to hear that solution for removing the comma on the axis label has worked. 
Query: if you see in that image ending text of x-axis label is not showing full. How do fix this issue?  
We would like to let you know that your requirement is to “Completely show the last axis label” then it can be achieved by setting the EdgeLabelsDrawingMode as Shift for CategoryAxis, and this property is used to position the axis label based on its size as per in below code snippet.  
Code Snippet[Xaml]:  
<chart:CategoryAxis EdgeLabelsDrawingMode="Shift" >  
For more details please refer below UG link.  
Please let us know if need any further assistance on this.  
Hemalatha M. 


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