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

How to set interval type for days with interval 24hrs ?

I need X-axis should be week as Sunday, Monday .....
Between a Day I want to plot data for a day(24 hours) how do I have to achieve this.
Here is my XAxis
DayOfWeek day = DateTime.Now.DayOfWeek;
int days = day - DayOfWeek.Sunday;
DateTime start = DateTime.Now.AddDays(-days);
DateTime end = start.AddDays(6);
XAxis.IntervalType = Syncfusion.SfChart.XForms.DateTimeIntervalType.Days;
XAxis.Interval = 23;
XAxis.Minimum = start;
XAxis.Maximum = end;
XAxis.LabelStyle.LabelFormat = "ddd";
Please provide any sample for this scenario

1 Reply

HM Hemalatha Marikumar Syncfusion Team October 30, 2019 05:00 AM

Hi Bharath, 
 
Greetings from Syncfusion. 
  
We have analyzed your code and we suspect that your requirement is to show the day of week in axis labels. You can achieve that by setting IntervalType as Days and Interval as 1. Please refer the below code. 
  
Code snippet[C#]: 
XAxis.IntervalType = Syncfusion.SfChart.XForms.DateTimeIntervalType.Days; 
XAxis.LabelRotationAngle = -45; 
XAxis.Interval = 1; 
XAxis.Minimum = start; 
XAxis.Maximum = end; 
XAxis.LabelStyle.LabelFormat = "dddd"; 
  
  
Screenshot: 
 
  
If your requirement is different from the above solution. Please provide an exact requirement of yours and please share the screenshot. This will be helpful for us to provide a better solution at the earliest. 
 
Regards, 
Hemalatha M. 


Loader.
Live Chat Icon For mobile
Up arrow icon