dateTimeAxis shows incorrect values for different language regions

Hello,
I am using SfChart in my application and I ran into a problem with how a time is displayed.

I do have dateTimeAxis defined and no matter of Andorid language, following values are shown:
10:30
11:00
11:30
12:00
12:30
01:00
01:30

But I would expect
10:30
11:00
11:30
12:00
12:30
13:00
13:30

Is there a way how to achieve this?
Thanks

7 Replies 1 reply marked as answer

YP Yuvaraj Palanisamy Syncfusion Team August 24, 2020 10:41 AM UTC

 
Greetings from Syncfusion. 
 
We have analyzed your query and you can achieve your requirement by using ChartAxis LabelFormat support in SfChart. Please find the following code snippet. 
 
 
chart.PrimaryAxis.LabelStyle.LabelFormat = "HH:MM"; 
 
 
For more information please refer the following link. 
 
Regards, 
Yuvaraj P 



MA Martin ARION August 28, 2020 08:14 AM UTC

Hello,
thanks a lot for the response. Unfortunately the solution does not work for me. I will explain.

In my application I can have a graph, which has o lot of data, where months or years are shown. Then I need a possibility do drill down into a detail where time scale changes to hours.
If I set LabelFormat as you proposed, HH:MM are shown even though in if I am zoomed out.

Basically I would like to keep the configuration where the time scale is automatically adjusted based on zoom level, but in case where hours and minutes are shown, I need to show then in 16:38 format.

Thanks a lot 


YP Yuvaraj Palanisamy Syncfusion Team August 31, 2020 12:58 PM UTC

Hi Martin ARION, 

Currently we are working on this and we will update you complete details on or before 2nd September 2020. 

Regards, 
Yuvaraj 



YP Yuvaraj Palanisamy Syncfusion Team September 2, 2020 02:07 PM UTC

 
Thanks for your patience. 
 
We have achieved your requirement “Change Hours DateTime format when drill down to hours axis visible labels” by using ZoomDelta event of SfChart. Please find the Code snippet below 
 
 
SfChart chart = new SfChart(this); 
. . . 
chart.ZoomDelta += Chart_ZoomDelta; 
 
private void Chart_ZoomDelta(object sender, SfChart.ZoomDeltaEventArgs e) 
        { 
            var axis = (sender as SfChart).PrimaryAxis; 
            axis.LabelStyle.LabelFormat = GetSpecificFormatedLabel((axis as DateTimeAxis).ActualIntervalType);             
        } 
 
private string GetSpecificFormatedLabel(DateTimeIntervalType actualIntervalType) 
        { 
            if (actualIntervalType == DateTimeIntervalType.Days) 
            { 
                return "MMM-dd"; 
            } 
            else if (actualIntervalType == DateTimeIntervalType.Months) 
            { 
                return "MMM-yyyy"; 
            } 
            else if (actualIntervalType == DateTimeIntervalType.Years) 
            { 
                return "yyyy"; 
            } 
            else if (actualIntervalType == DateTimeIntervalType.Hours) 
            { 
                return "hh:mm"; 
            } 
            else if (actualIntervalType == DateTimeIntervalType.Minutes) 
            { 
                return "hh:mm:ss"; 
            } 
            else if (actualIntervalType == DateTimeIntervalType.Seconds) 
            { 
                return "hh:mm:ss"; 
            } 
            else if (actualIntervalType == DateTimeIntervalType.Milliseconds) 
            { 
                return "ss.SSS"; 
            } 
 
            return "dd/MMM/yyyy"; 
        } 
 
 
Also, we have attached the sample for your reference. Please find the sample from the below link. 
 
  
For more information, 
 
  
Regards, 
Yuvaraj 



MA Martin ARION September 2, 2020 04:29 PM UTC

Hello,
thanks a lot. I tried to build your solution, unfortunately it does not seems to be working on physical phone neither on simulator.

See the screenshot


Thanks,
Tomas

Marked as answer

MA Martin ARION September 2, 2020 09:12 PM UTC

Hello,
it is working now. Once I used HH in uppercase, your sample started to work.

Thanks a lot for you help, you can close the case.

With regards,
Tomas


RS Ramya Soundar Rajan Syncfusion Team September 3, 2020 06:06 AM UTC

 
Thanks for your update.  
  
Please let us know if you would require any further assistance. 
 
Regards, 
Ramya S               


Loader.
Up arrow icon