How to do a X Axis Range for Dates

3 posts, 1 answers
  1. chris
    chris avatar
    32 posts
    Member since:
    Jul 2011

    Posted 09 Sep 2011 Link to this post

    Hello everyone,

    I am trying to have a Range of 14 days as my X Axis for my Chart Control. The AddRange() only takes doubles, so is there a different method that I can use to get a Range from 13 days ago all the way up to and including Today? If anyone can help that would be great.

    Thank you,
    Chris
  2. Answer
    Missing user
    Missing user avatar

    Posted 14 Sep 2011 Link to this post

    Hi Chris,

    DataPoint.XValue is of type double. Therefore, the DateTime values have to be converted to OLE Automation dates first, by the DateTime.ToOADate() method. For example:
    double min = DateTime.Today.AddDays(-13).ToOADate();
    double max = DateTime.Today.ToOADate();
    double step = DateTime.Today.ToOADate() - DateTime.Today.AddDays(-1).ToOADate();
     
    radChart.DefaultView.ChartArea.AxisX.AddRange(min, max, step);

    Also, the AxisX.IsDateTime property should be set to True. For additional information on "DateTime Support", please refer to the following help topic:
    http://www.telerik.com/help/wpf/radchart-features-datetime-support.html

    I hope this information helps.

    Greetings,
    Polina
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. chris
    chris avatar
    32 posts
    Member since:
    Jul 2011

    Posted 14 Sep 2011 Link to this post

    Thank you very much, This solved my problem.

    Telerik has the best support on the web.
Back to Top