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.
Unfortunately, activation email could not send to your email. Please try again.

Label Created

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 06:21 AM

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"; 
       else 
          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. 
Regards, 
Muneesh Kumar G. 



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.

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.

;