RadChart IsDateTime=True and Step interval in days

6 posts, 0 answers
  1. Charles Macleod
    Charles Macleod avatar
    3 posts
    Member since:
    Dec 2009

    Posted 27 May 2010 Link to this post

    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.
  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 01 Jun 2010 Link to this post

    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.
  3. DevCraft banner
  4. Robert Kaucher
    Robert Kaucher avatar
    56 posts
    Member since:
    Oct 2010

    Posted 24 Jun 2011 Link to this post

    For something that seems like a common way to use the radchart this was EXCEPTIONALLY hard to find.
  5. Sowjanya
    Sowjanya avatar
    8 posts
    Member since:
    May 2013

    Posted 08 Jul 2013 Link to this post

    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
  6. Sowjanya
    Sowjanya avatar
    8 posts
    Member since:
    May 2013

    Posted 08 Jul 2013 Link to this post

    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
  7. Robert Kaucher
    Robert Kaucher avatar
    56 posts
    Member since:
    Oct 2010

    Posted 08 Jul 2013 Link to this post

    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.
Back to Top
DevCraft banner