Binding the X-axis to a DateTime

3 posts, 0 answers
  1. Schley
    Schley avatar
    7 posts
    Member since:
    Jan 2009

    Posted 14 Feb 2012 Link to this post

    Am I mistaken in understanding that the RadChart control cannot recognize beyond the Day component of a DateTime with regards to specificity. I plotted five values and they all appeared along the origin. Their X-values were different by seconds.
  2. Schley
    Schley avatar
    7 posts
    Member since:
    Jan 2009

    Posted 14 Feb 2012 Link to this post

    I discovered my mistake and have it working. However, what if the Min and Max values are separated by 60 seconds. How do I indicate that the step should represent 5 second intervals so that the appropriate tick marks are created?
  3. UI for WPF is Visual Studio 2017 Ready
  4. Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 17 Feb 2012 Link to this post

    Hi Schley,

    You may review our SL demo (the approach is absolutetely the same for WPF) where we specified a Step of 1 sec to the XAxis - http://demos.telerik.com/silverlight/#Chart/LiveData

    private void SetUpAxisXRange(DateTime now)
            {
                this.AxisXMinValue = now.AddSeconds(-14.5).ToOADate();
                this.AxisXMaxValue = now.ToOADate();
                this.AxisXStep = 1.0 / 24.0 / 3600.0 / 2.0;
            }

    You can easily customize the Step using the formula, but note that you should have the AutoRange property of the XAxis to false to have your modifications applied.

    All the best,
    Evgenia
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top