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

date Format DateTimeAxis

I cannot see a way to format the date in the DateTimeAxis.

Something like what we have in the SfDateTimeRangeNavigator e.g. SfDateTimeRangeNavigator.TooltipFormat = "dd/MM/yyyy";

Where is it?

Thanks!

3 Replies

SP Saravana Pandian Murugan Syncfusion Team August 3, 2017 05:21 AM UTC

Hi David, 
  
Thanks for using Syncfusion products. 
  
You can achieve this requirement by using LabelFormat property of ChartAxisLabelStyle. Please find the below code snippet below. 
Code Example:  
  
[XAML]: 
  
  
<chart:SfChart.PrimaryAxis> 
  
    <chart:DateTimeAxis> 
  
        <chart:DateTimeAxis.LabelStyle> 
  
             <chart:ChartAxisLabelStyle LabelFormat ="dd/MMM"/>  
  
        </chart:DateTimeAxis.LabelStyle> 
  
    </chart:DateTimeAxis> 
  
</chart:SfChart.PrimaryAxis> 
  
  
[C#]: 
  
 
DateTimeAxis dateTimeAxis = new DateTimeAxis(); 
  
dateTimeAxis.LabelStyle.LabelFormat = "dd/MMM"; 
  
chart.PrimaryAxis = dateTimeAxis; 
  
  
We have prepared sample as per your requirement which can be downloaded from the following location. 
  
  
Please check the attached sample and let us know if you need further assistance on this. 
  
Regards, 
Saravana Pandian M. 



DP David Perera August 3, 2017 07:35 AM UTC

That works perfect. Thanks!



SP Saravana Pandian Murugan Syncfusion Team August 3, 2017 10:53 PM UTC

Hi David,

Thanks for the update. We are glad to know that the given solution worked. Please get back to us if you need further assistance.

Regards,
Saravana Pandian M.


Loader.
Live Chat Icon For mobile
Up arrow icon