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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Label Created

Thread ID:





132540 Sep 7,2017 10:38 AM UTC Sep 8,2017 10:21 AM UTC Xamarin.Android 1
Tags: SfChart
Roi Godelman
Asked On September 7, 2017 10:38 AM UTC

Hi Symcfusion,
I am using DateTimeAxis and the event LableCreated
and I wants the DateTime of the point and to change the label how
can I get the DateTime from ChartAxis.LabelCreatedEventArgs
Thanks, Roi 

Muneesh Kumar G [Syncfusion]
Replied On September 8, 2017 10:21 AM UTC

Hi Roi Godelman, 
Thanks for using Syncfusion products. 
Solution 1:  
We can get the DateTime of label by using Position property in AxisLabel and we can change the label by using LabelContent property as per the below code snippet.   
Code Snippet [C#] 
privatevoid PrimaryAxis_LabelCreated(object sender, ChartAxis.LabelCreatedEventArgs e) 
       DateTime dt = DateTime.FromOADate(e.AxisLabel.Position); 
       if (dt.Hour < 12) 
          e.AxisLabel.LabelContent = e.AxisLabel.LabelContent + " AM"; 
          e.AxisLabel.LabelContent = e.AxisLabel.LabelContent + " PM"; 
Solution 2 :  
We can change the DateTimeAxis label by setting LabelFormat in DateTimeAxis as per the below code snippet. 
Code Snippet [C#] 
DateTimeAxis dateTimeAxis = newDateTimeAxis(); 
dateTimeAxis.LabelStyle.LabelFormat = "yyyy/MMM"; 
chart.PrimaryAxis = dateTimeAxis; 
We have prepared a sample based on this and you can find the sample under the following location:  
Sample: http://www.syncfusion.com/downloads/support/forum/132540/ze/Sample1457582701 
Please let us know if you have any queries. 
Muneesh Kumar G. 


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

or the page will be automatically redirected to 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