Date format issue

Hello,

I have an issue trying to format the DateTimeAxis

Currently I need to format it in 2 different ways

AxisFormat = "ddd dd MMM";
or
AxisFormat = "MMM yyyy";

In UWP its working, it shows wed 22 feb and feb 2018
but in iOS it shows something like 022 22 feb and feb 2018

How can I fix the ddd dd MMM to show the same in all 3 platforms?

Thanks in advance

3 Replies

DV Divya Venkatesan Syncfusion Team February 23, 2018 11:11 AM UTC

Hi Juan, 
 
Thanks for using Syncfusion products. 
 
Please set the LabelFormat platform specifically as shown in the below code snippets. 
 
Xaml: 
 
<chart:DateTimeAxis.LabelStyle> 
    <chart:ChartAxisLabelStyle> 
        <chart:ChartAxisLabelStyle.LabelFormat> 
            <OnPlatform x:TypeArguments="x:String" iOS="EEE dd MMM" Android="EEE dd MMM" WinPhone="ddd dd MMM"/> 
        </chart:ChartAxisLabelStyle.LabelFormat> 
    </chart:ChartAxisLabelStyle> 
</chart:DateTimeAxis.LabelStyle> 
 
C#: 
 
switch (Device.RuntimePlatform) 
{ 
    case Device.Android: 
        dateTimeAxis.LabelStyle.LabelFormat = "EEE dd MMM"; 
        break; 
    case Device.iOS: 
        dateTimeAxis.LabelStyle.LabelFormat = "EEE dd MMM"; 
        break; 
    case Device.UWP: 
        dateTimeAxis.LabelStyle.LabelFormat = "ddd dd MMM"; 
        break; 
} 
 
Please let us know if you need any further assistance. 
 
Regards, 
Divya Venkatesan 
 



JC Juan Carlos Gonzalez Salazar February 23, 2018 06:30 PM UTC

It works fine, thank you!


DV Divya Venkatesan Syncfusion Team February 26, 2018 10:50 AM UTC

Hi Juan,

Thanks for the update. We are glad to know that the given solution works.

Please let us know if you need any further assistance.

Regards,
Divya Venkatesan

Loader.
Up arrow icon