This is a migrated thread and some comments may be shown as answers.

RadChart IsDateTime=True and Step interval in days

5 Answers 183 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Charles Macleod
Top achievements
Rank 1
Charles Macleod asked on 28 May 2010, 12:14 AM
Hi,
We are using the RadChart for Silverlight, Q1, 2010.1.422. We are plotting line series data that is specified at the level of days BUT covers multiple years. For example, we may have 20 or 30 data points spread across 40 years. We manually (in code) specify the XAxis parameters to include the IsDateTime, the LabelStep, MaxValue and MinValue, and Step. Additionally, AutoRange is set to FALSE.

Basically, we recieve some time series data from a web service. We extract the start and end dates and configure the Min and Max values on the X axis accordingly. We also compute the number of labels we will show (LabelStep) and the ~all important~ Step value.We were setting the Step value in multiples of 365 (i.e. in multiples of a year but specified in Days) as we have a broad range (years) between the data points. However, the labels were always off. We would get, for example, 1990, 1991, 1992, 1993, 1993. Turning on the day and month on the label shows why - we would get 1/1/1990, 1/1/1991, 1/1/1992, 1/1/1993, 12/31/1993, ..... The labels start moving back to the last day of the previous year.

Okay - so, clearly "365" is not quite right as a "Step" - allright, so you say, a ha -  there are "365.25" days per year so let's set the Step value to be multiples of ~that~...well...it's a little bit better. Now, we can go about 10 or 20 years before the X Axis labels are off. Similar fiddling with the Step value (365.3, 365.4, etc.) produced similar results - labels are good initially but ultimately end up wrong. There does not seem to be a "right" Step value.

This is pretty frustrating. It seems that the ~only~ Step that actually works for DateTime is multiples of years or days when the timespan of the dataset is "narrow". I can see how, say months can be problematic given that there length can change with leap year but even that seems hardly insurmountable, and days per year are very regular (otherwise our calendars would fall apart) - 365, 365.25, or whatever level of precision RadChart requires.

Personally, I think this is a bug but I'm willing to give Telerik the benefit of the doubt until I hear back on this issue. There should be a specific, documented constant step value that works in these cases.

5 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 01 Jun 2010, 05:30 PM
Hi Charles,

I have already replied to your support ticket and I will paste my answer here in case anyone else runs into similar issues:

Thank you for the detailed feedback. Indeed, this is an issue with the current implementation of AxisX in RadChart. And yes -- I would agree -- the issue is even worse with months. Our developers are aware of this and we have scheduled improvements in this area for Q2, expected in July.

Here is what you can do for the moment: configure AxisX, so that the ticks shown are somewhere in the middle of the month/year, but not in the very beginning or very end. This way the tick will not always represent the same day, but it will always stay within the same month/year. I have attached a small example, showing this. I hope this approach will be applicable.


Regards,
Ves
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Robert Kaucher
Top achievements
Rank 2
answered on 24 Jun 2011, 01:22 PM
For something that seems like a common way to use the radchart this was EXCEPTIONALLY hard to find.
0
Sowjanya
Top achievements
Rank 1
answered on 08 Jul 2013, 11:11 AM
Hi Team,
We are using Rad Controls Q1 2013 version. I have a requirement where I have to show data for 1 hour, 24 hours, 7 days, 30 days, 365 days alternatively in a rad chart.
I am able to achieve all the intervals other than 1 month interval to show data for 365 days.
Could you let me know if this feature can be achievable with the version I am using. I will have to show data in dd MMM yyyy format like 01 Jan 2012, 01 Feb 2012,........ 01 jan 2013 etc.,

Thanks in Advance
0
Sowjanya
Top achievements
Rank 1
answered on 08 Jul 2013, 11:15 AM
double oneMinute = 1 / 1440d;
                double tenMinutes = 10 / 1440d;
                double fourHours = 4 / 24d;
                double oneDay = 24 / 24d; // one day = 24 hours
                double fiveDays = 120 / 24d;
  
                double startTime = dataSeries[0].XValue;
                double endTime = dataSeries[dataSeries.Count - 1].XValue;
  
                double start365Time = HouseConsumptionData.First().TimeStamp.ToOADate();
                double end365Time = HouseConsumptionData.Last().TimeStamp.ToOADate();
  
                houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.IsDateTime = true;
                houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "HH:mm:ss";
                houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.AutoRange = false;
                houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.MinValue = startTime;
                houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.MaxValue = endTime;
                // Five Minutes Interval 
                if (selectedInterval == EMIntervalEnum.Five_Minutes)
                {
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.Step = oneMinute;
                }
                // One Hour Interval
                else if (selectedInterval == EMIntervalEnum.One_Hour)
                {
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.Step = tenMinutes;
                }
                // 24 Hours interval
                else if (selectedInterval == EMIntervalEnum.One_Day)
                {
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.Step = fourHours;
                }
                // 7 days interval
                else if (selectedInterval == EMIntervalEnum.One_Week)
                {
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd MMM yyyy";
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.Step = oneDay;
                }
                // 30 days interval
                else if (selectedInterval == EMIntervalEnum.One_Month)
                {
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd MMM yyyy";
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.Step = fiveDays;
                }
                //365 days interval
                else if (selectedInterval == EMIntervalEnum.One_Year)
                {
                        // Looking for a  solution
                }
Hi Team,
We are using Rad Controls Q1 2013 version. I have a requirement where I have to show data for 1 hour, 24 hours, 7 days, 30 days, 365 days alternatively in a rad chart.
I am able to achieve all the intervals other than 1 month interval to show data for 365 days.
Could you let me know if this feature can be achievable with the version I am using. I will have to show data in dd MMM yyyy format like 01 Jan 2012, 01 Feb 2012,........ 01 jan 2013 etc.,

Please find the code snippet I am currently using

Thanks in Advance
0
Robert Kaucher
Top achievements
Rank 2
answered on 08 Jul 2013, 03:33 PM
Sowjayna,

Since this post was started in 2010 you should post your own question as a new thread. The chances of the Telerik team looking at this is likely low because it might be seen as a reply to a question, not a question in its own right.
Tags
Chart
Asked by
Charles Macleod
Top achievements
Rank 1
Answers by
Ves
Telerik team
Robert Kaucher
Top achievements
Rank 2
Sowjanya
Top achievements
Rank 1
Share this question
or